diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2016-01-22 22:43:39 +0100 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2016-01-26 23:47:09 +0100 |
commit | b3e0391f53d98b777d6cdb21ba0492c31927a6f0 (patch) | |
tree | e6df34c1677b385fae1958da5299512da21fdd19 /src/web | |
parent | bumping deps (diff) | |
download | newspipe-b3e0391f53d98b777d6cdb21ba0492c31927a6f0.tar.gz newspipe-b3e0391f53d98b777d6cdb21ba0492c31927a6f0.tar.bz2 newspipe-b3e0391f53d98b777d6cdb21ba0492c31927a6f0.zip |
ordering feeds
Diffstat (limited to 'src/web')
-rw-r--r-- | src/web/js/components/Menu.react.js | 3 | ||||
-rw-r--r-- | src/web/views/views.py | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/web/js/components/Menu.react.js b/src/web/js/components/Menu.react.js index ef0ec274..7f5f17bc 100644 --- a/src/web/js/components/Menu.react.js +++ b/src/web/js/components/Menu.react.js @@ -46,10 +46,13 @@ var Category = React.createClass({ }, render: function() { var filter = this.props.filter; + // filtering according to this.props.filter var feeds = this.props.feeds.filter(function(feed) { if (filter == 'unread' && feed.unread <= 0) {return false;} else if (filter == 'error' && feed.error_count <= 3){return false;} return true; + }).sort(function(feed_a, feed_b){ + return feed_b.unread - feed_a.unread; }).map(function(feed) { return (<FeedItem key={"feed" + feed.id} feed_id={feed.id} title={feed.title} unread={feed.unread} diff --git a/src/web/views/views.py b/src/web/views/views.py index ae3d9b01..cc9b421c 100644 --- a/src/web/views/views.py +++ b/src/web/views/views.py @@ -262,14 +262,16 @@ def get_menu(): @app.route('/middle_panel') @login_required def get_middle_panel(): - fd_hash = {fd.id: fd for fd in FeedController(g.user.id).read()} + fd_hash = {feed.id: {'title': feed.title, + 'icon_url': url_for('icon.icon', url=feed.icon_url) + if feed.icon_url else None} + for feed in FeedController(g.user.id).read()} articles = ArticleController(g.user.id).read(readed=False).order_by('date') return jsonify(**{'articles': [{'title': art.title, 'liked': art.like, 'read': art.readed, 'article_id': art.id, 'feed_id': art.feed_id, 'category_id': art.category_id or 0, - 'feed_title': fd_hash[art.feed_id].title, - 'icon_url': url_for('icon.icon', url=fd_hash[art.feed_id].icon_url) - if fd_hash[art.feed_id].icon_url else None, + 'feed_title': fd_hash[art.feed_id]['title'], + 'icon_url': fd_hash[art.feed_id]['icon_url'], 'date': art.date} for art in articles]}) |