aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/static/js/articles.js7
-rw-r--r--pyaggr3g470r/templates/home.html4
2 files changed, 9 insertions, 2 deletions
diff --git a/pyaggr3g470r/static/js/articles.js b/pyaggr3g470r/static/js/articles.js
index 990f293c..bd4e9627 100644
--- a/pyaggr3g470r/static/js/articles.js
+++ b/pyaggr3g470r/static/js/articles.js
@@ -25,6 +25,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') }
// Mark an article as read or unread.
$('.readed').on('click', function() {
var article_id = $(this).parent().parent().parent().attr("data-article");
+ var feed_id = $(this).parent().parent().parent().attr("data-feed");
var filter = $('#filters').attr("data-filter");
var data;
@@ -34,10 +35,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') }
})
if (filter == "read") {
$(this).parent().parent().parent().remove();
+ $("#total-unread").text(parseInt($("#total-unread").text()) - 1);
+ $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) + 1);
}
else {
// here, filter == "all"
$(this).removeClass('glyphicon-unchecked').addClass('glyphicon-check');
+ $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) + 1);
}
}
else {
@@ -46,10 +50,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') }
})
if (filter == "unread") {
$(this).parent().parent().parent().remove();
+ $("#total-unread").text(parseInt($("#total-unread").text()) - 1);
+ $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) - 1);
}
else {
// here, filter == "all"
$(this).removeClass('glyphicon-check').addClass('glyphicon-unchecked');
+ $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) - 1);
}
}
diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html
index 2a9fac48..a8b0e7bc 100644
--- a/pyaggr3g470r/templates/home.html
+++ b/pyaggr3g470r/templates/home.html
@@ -21,7 +21,7 @@
{% for fid, nbunread in unread|dictsort(by='value')|reverse %}
<li class="feed-menu"><a href="{{ gen_url(feed=fid) }}">
{% if feed_id == fid %}<b>{% endif %}
- <span class="badge pull-right">{{ nbunread }}</span>
+ <span id="unread-{{ fid }}" class="badge pull-right">{{ nbunread }}</span>
{{ feeds[fid]|safe }}
{% if feed_id == fid %}</b>{% endif %}
</a></li>
@@ -50,7 +50,7 @@
</ul>
</div>
<div class="container col-md-9">
- <h1>{{ _('Articles') }} ({{ articles.__len__() }})</h1>
+ <h1>{{ _('Articles') }} (<span id="total-unread">{{ articles.__len__() }}</span>)</h1>
<div id="filters" data-filter="{{ filter_ }}">
{% if filter_ == 'all' %}<b>{% endif %}
<a href="{{ gen_url(filter_='all') }}">{{ _('All') }}</a>
bgstack15