mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Mark feed as read button.
This commit is contained in:
parent
571d9556d5
commit
d18ee60599
3 changed files with 80 additions and 17 deletions
|
@ -35,6 +35,12 @@ def save_classifier(request):
|
|||
message = 'OK'
|
||||
payload = {}
|
||||
|
||||
# Make subscription as dirty, so unread counts can be recalculated
|
||||
usersub = UserSubscription.objects.get(user=request.user, feed=feed)
|
||||
if not usersub.needs_unread_recalc:
|
||||
usersub.needs_unread_recalc = True
|
||||
usersub.save()
|
||||
|
||||
def _save_classifier(ClassifierCls, content_type, ContentCls=None, post_content_field=None):
|
||||
classifiers = {
|
||||
'like_'+content_type: 1,
|
||||
|
|
|
@ -191,6 +191,9 @@ background: transparent;
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
#feed_list .NB-feedbar-mark-feed-read {
|
||||
display: none;
|
||||
}
|
||||
#feed_list .feed.selected {
|
||||
background: #f6a828 url('../theme/images/ui-bg_highlight-hard_35_f6a828_1x100.png') 0 50% repeat-x;
|
||||
border-top: 1px solid #A8A8A8;
|
||||
|
@ -294,10 +297,41 @@ background: transparent;
|
|||
border-bottom: 2px solid #404040;
|
||||
position: relative;
|
||||
}
|
||||
#story_titles .NB-feedbar .feed {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#story_titles .NB-feedbar .feed .feed_favicon {
|
||||
margin-right: 8px;
|
||||
vertical-align: top;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#story_titles .NB-feedbar .feed .feed_title {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#story_titles .NB-feedbar .NB-feedbar-mark-feed-read {
|
||||
background-color: #3090cf;
|
||||
color: #F0F0F0;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: 200px;
|
||||
font-size: 9px;
|
||||
line-height: 11px;
|
||||
font-weight: bold;
|
||||
margin: 3px 11px 2px;
|
||||
padding: 0px 4px 0;
|
||||
text-transform: uppercase;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#story_titles .NB-feedbar.NB-feedbar-hover .NB-feedbar-mark-feed-read {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#story_titles .NB-feedbar .NB-feedbar-mark-feed-read:hover {
|
||||
background-color: #00609f;
|
||||
}
|
||||
|
||||
#story_titles .NB-feedbar .feed .feed_counts {
|
||||
|
@ -364,6 +398,7 @@ background: transparent;
|
|||
|
||||
|
||||
#story_titles .story {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
|
@ -396,6 +431,7 @@ background: transparent;
|
|||
color: #272727;
|
||||
display: block;
|
||||
padding: 4px 0px;
|
||||
float: left;
|
||||
}
|
||||
#story_titles .story.read a.story_title {
|
||||
color: #575757;
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
'feed_view_story_positions_keys': []
|
||||
};
|
||||
|
||||
$('body').bind('click.reader', $.rescope(this.handle_clicks, this));
|
||||
$('body').bind('dblclick.reader', $.rescope(this.handle_dblclicks, this));
|
||||
$('body').bind('click.reader', $.rescope(this.handle_clicks, this));
|
||||
$('#story_titles').scroll($.rescope(this.handle_scroll_story_titles, this));
|
||||
this.$feed_view.scroll($.rescope(this.handle_scroll_feed_view, this));
|
||||
|
||||
|
@ -430,7 +430,8 @@
|
|||
])
|
||||
]),
|
||||
$.make('img', { className: 'feed_favicon', src: this.google_favicon_url + feed.feed_link }),
|
||||
$.make('span', { className: 'feed_title' }, feed.feed_title)
|
||||
$.make('span', { className: 'feed_title' }, feed.feed_title),
|
||||
$.make('div', { className: 'NB-feedbar-mark-feed-read' }, 'Mark All as Read')
|
||||
]).data('feed_id', feed.id);
|
||||
|
||||
return $feed;
|
||||
|
@ -498,21 +499,23 @@
|
|||
open_feed: function(feed_id, $feed_link) {
|
||||
var self = this;
|
||||
var $story_titles = this.$story_titles;
|
||||
$story_titles.empty().scrollTop('0px');
|
||||
|
||||
this.reset_feed();
|
||||
this.hide_splash_page();
|
||||
if (feed_id != this.active_feed) {
|
||||
$story_titles.empty().scrollTop('0px');
|
||||
this.reset_feed();
|
||||
this.hide_splash_page();
|
||||
|
||||
this.active_feed = feed_id;
|
||||
this.$story_titles.data('page', 0);
|
||||
this.$story_titles.data('feed_id', feed_id);
|
||||
this.active_feed = feed_id;
|
||||
this.$story_titles.data('page', 0);
|
||||
this.$story_titles.data('feed_id', feed_id);
|
||||
|
||||
this.show_feed_title_in_stories($story_titles, feed_id);
|
||||
this.mark_feed_as_selected(feed_id, $feed_link);
|
||||
this.show_feedbar_loading();
|
||||
this.model.load_feed(feed_id, 0, true, $.rescope(this.post_open_feed, this));
|
||||
this.show_feed_page_contents(feed_id);
|
||||
this.show_correct_story_view(feed_id);
|
||||
this.show_feed_title_in_stories($story_titles, feed_id);
|
||||
this.mark_feed_as_selected(feed_id, $feed_link);
|
||||
this.show_feedbar_loading();
|
||||
this.model.load_feed(feed_id, 0, true, $.rescope(this.post_open_feed, this));
|
||||
this.show_feed_page_contents(feed_id);
|
||||
this.show_correct_story_view(feed_id);
|
||||
}
|
||||
},
|
||||
|
||||
post_open_feed: function(e, data, first_load) {
|
||||
|
@ -1275,10 +1278,25 @@
|
|||
|
||||
mark_feed_as_read: function(feed_id) {
|
||||
var self = this;
|
||||
|
||||
var $feed = this.find_feed_in_feed_list(feed_id);
|
||||
var $story_feedbar = $('.NB-feedbar .feed');
|
||||
var $story_titles = this.$story_titles;
|
||||
|
||||
var callback = function() {
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
$('.unread_count_neutral', $feed).text(0);
|
||||
$('.unread_count_positive', $feed).text(0);
|
||||
$('.unread_count_negative', $feed).text(0);
|
||||
$('.unread_count_neutral', $story_feedbar).text(0);
|
||||
$('.unread_count_positive', $story_feedbar).text(0);
|
||||
$('.unread_count_negative', $story_feedbar).text(0);
|
||||
$('.story:not(.read)', $story_titles).addClass('read');
|
||||
$feed.removeClass('unread_neutral');
|
||||
$feed.removeClass('unread_positive');
|
||||
$feed.removeClass('unread_negative');
|
||||
|
||||
this.model.mark_feed_as_read(feed_id, callback);
|
||||
},
|
||||
|
@ -1311,10 +1329,11 @@
|
|||
var feed_id = $t.data('feed_id');
|
||||
self.open_feed(feed_id, $t);
|
||||
});
|
||||
$.targetIs(e, { tagSelector: 'a.mark_feed_as_read' }, function($t, $p){
|
||||
$.targetIs(e, { tagSelector: '.NB-feedbar-mark-feed-read' }, function($t, $p){
|
||||
e.preventDefault();
|
||||
var feed_id = $t.data('feed_id');
|
||||
var feed_id = $t.parents('.feed').data('feed_id');
|
||||
self.mark_feed_as_read(feed_id, $t);
|
||||
$t.fadeOut(400);
|
||||
});
|
||||
|
||||
// ============
|
||||
|
@ -1412,6 +1431,7 @@
|
|||
|
||||
$.targetIs(e, { tagSelector: '#story_titles .story' }, function($t, $p){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
// NEWSBLUR.log(['Story dblclick', $t]);
|
||||
var story_id = $('.story_id', $t).text();
|
||||
var story = self.find_story_in_stories(story_id);
|
||||
|
@ -1419,6 +1439,7 @@
|
|||
});
|
||||
$.targetIs(e, { tagSelector: '#feed_list .feed' }, function($t, $p){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
// NEWSBLUR.log(['Feed dblclick', $('.feed_id', $t), $t]);
|
||||
var feed_id = $t.data('feed_id');
|
||||
self.open_feed_link(feed_id, $t);
|
||||
|
|
Loading…
Add table
Reference in a new issue