aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-01 21:49:07 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-01 21:49:07 +0100
commit776577fdf90b2eaedd09739795a38b5962ee602e (patch)
tree00cfa868d43689ec32bfb4ecb4d4057ad57852fe
parentimproved home page loading (diff)
downloadnewspipe-776577fdf90b2eaedd09739795a38b5962ee602e.tar.gz
newspipe-776577fdf90b2eaedd09739795a38b5962ee602e.tar.bz2
newspipe-776577fdf90b2eaedd09739795a38b5962ee602e.zip
display a flag if more than 1000 articles are unread
-rw-r--r--newspipe/web/templates/home.html3
-rw-r--r--newspipe/web/views/home.py2
2 files changed, 4 insertions, 1 deletions
diff --git a/newspipe/web/templates/home.html b/newspipe/web/templates/home.html
index cb0ac322..a0e7d798 100644
--- a/newspipe/web/templates/home.html
+++ b/newspipe/web/templates/home.html
@@ -18,7 +18,8 @@
<ul class="nav flex-column" data-offset-top="0" data-offset-bottom="0" style="min-height: 650px;">
<li class="nav-item"><a class="nav-link" href="{{ gen_url(feed=0) }}">
{% if not feed_id %}<b>{% endif %}
- {{ _('All feeds') }} <span id="total-unread" class="badge pull-right">{{ articles.__len__() }}</span>
+ {{ _('All feeds') }}
+ <span id="total-unread" class="badge pull-right"> {% if nb_unread > 1000 %}>{% endif %}&nbsp;{{ articles.__len__() }}</span>
{% if not feed_id %}</b>{% endif %}
</a></li>
{% for fid, nbunread in unread|dictsort(by='value')|reverse %}
diff --git a/newspipe/web/views/home.py b/newspipe/web/views/home.py
index d5b583d3..7cf5983c 100644
--- a/newspipe/web/views/home.py
+++ b/newspipe/web/views/home.py
@@ -27,6 +27,7 @@ def home():
art_contr = ArticleController(current_user.id)
unread = art_contr.count_by_feed(readed=False)
+ nb_unread =art_contr.read_light(readed=False).count()
feeds = {feed.id: feed.title for feed in current_user.feeds}
@@ -64,6 +65,7 @@ def home():
return render_template(
"home.html",
+ nb_unread=nb_unread,
gen_url=gen_url,
feed_id=feed_id,
filter_=filter_,
bgstack15