aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-23 18:08:44 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-23 18:08:44 +0200
commit8f008278e0eb4f0c523ba301e13d4b03113927dc (patch)
tree6f434968267283d5f4ce2f730b2e2982c82787b5 /pyaggr3g470r
parentReduce space between items of lists. (diff)
downloadnewspipe-8f008278e0eb4f0c523ba301e13d4b03113927dc.tar.gz
newspipe-8f008278e0eb4f0c523ba301e13d4b03113927dc.tar.bz2
newspipe-8f008278e0eb4f0c523ba301e13d4b03113927dc.zip
Feeds with unread articles are displayed before.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/templates/home.html14
-rw-r--r--pyaggr3g470r/templates/layout.html3
-rw-r--r--pyaggr3g470r/views.py2
3 files changed, 8 insertions, 11 deletions
diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html
index 9fb1d57c..e453663c 100644
--- a/pyaggr3g470r/templates/home.html
+++ b/pyaggr3g470r/templates/home.html
@@ -3,11 +3,11 @@
<div class="container-fluid">
<div classe="row">
<div class="col-md-3">
- <ul class="nav navbarfeed">
- {% for feed in result|sort(attribute="title") %}
- <li class="navbarfeed">
+ <ul class="nav">
+ {% for feed in result|sort(attribute="title")|sort(attribute="nb_unread", reverse=True) %}
+ <li>
<a href="#{{ feed.id }}">
- {% if unread[feed.id] != 0 %}<span class="badge pull-right">{{ unread[feed.id] }}</span>{% endif %}
+ {% if feed.nb_unread != 0 %}<span class="badge pull-right">{{ feed.nb_unread }}</span>{% endif %}
{{ feed.title|safe }}
</a>
</li>
@@ -22,8 +22,8 @@
<div class="row" id="{{ feed.id }}">
<div class="col-md-6 col-md-offset-3">
<h1>{{ feed.title|safe }}
- {% if unread[feed.id] != 0 %}
- <a href="/unread/{{ feed.id }}" title="Unread articles"><span class="badge">{{ unread[feed.id] }}</span></a>
+ {% if feed.nb_unread != 0 %}
+ <a href="/unread/{{ feed.id }}" title="Unread articles"><span class="badge">{{ feed.nb_unread }}</span></a>
{% endif %}</h1>
<a href="/articles/{{ feed.id }}/100"><i class="glyphicon glyphicon-th-list" title="{{ _('More articles') }}"></i></a>
<a href="/feed/{{ feed.id }}"><i class="glyphicon glyphicon-info-sign" title="{{ _('Details') }}"></i></a>
@@ -31,7 +31,7 @@
{% if feed.enabled %}
<a href="/fetch/{{ feed.id }}"><i class="glyphicon glyphicon-cloud-download" title="{{ _('Fetch this feed') }}"></i></a>
{% endif %}
- {% if unread[feed.id] != 0 %}
+ {% if feed.nb_unread != 0 %}
<a href="/mark_as_read/{{ feed.id }}"><i class="glyphicon glyphicon-check" title="{{ _('Mark all as read') }}"></i></a>
{% endif %}
</div>
diff --git a/pyaggr3g470r/templates/layout.html b/pyaggr3g470r/templates/layout.html
index 31e8df72..41c1e503 100644
--- a/pyaggr3g470r/templates/layout.html
+++ b/pyaggr3g470r/templates/layout.html
@@ -18,9 +18,6 @@ deployed on Heroku or on a traditional server." />
<!-- Add custom CSS here -->
<style>
body {margin-top: 60px;}
- li.navbarfeed {
- margin: -10px;
- }
</style>
</head>
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index ec3fcf35..ed8d5fdd 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -215,13 +215,13 @@ def home():
user = User.query.filter(User.email == g.user.email).first()
result, unread = [], {}
for feed in user.feeds:
- unread[feed.id] = Article.query.filter(Article.user_id == g.user.id, Article.feed_id == feed.id, Article.readed == False).count()
new_feed = Feed()
new_feed.id = feed.id
new_feed.title = feed.title
new_feed.enabled = feed.enabled
new_feed.articles = Article.query.filter(Article.user_id == g.user.id,
Article.feed_id == feed.id).order_by(desc("Article.date")).limit(9)
+ new_feed.nb_unread = Article.query.filter(Article.user_id == g.user.id, Article.feed_id == feed.id, Article.readed == False).count()
result.append(new_feed)
unread_articles = len(Article.query.filter(Article.user_id == g.user.id, Article.readed == False).all())
return render_template('home.html', result=result, unread=unread, head_title=unread_articles)
bgstack15