Merge branch 'master' into circular

* master:
  Fixing double click on unread count to actually mark the feed as read.

Conflicts:
	media/js/newsblur/views/feed_title_view.js
This commit is contained in:
Samuel Clay 2013-05-06 13:23:14 -07:00
commit 66125d306f
3 changed files with 35 additions and 7 deletions

View file

@ -228,6 +228,12 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
this.make_request('/reader/mark_feed_as_read', {
feed_id: feed_ids
}, callback);
if (feed_id == NEWSBLUR.reader.active_feed) {
this.stories.each(function(story) {
story.set('read_status', true);
});
}
},
mark_story_as_shared: function(params, callback, error_callback) {

View file

@ -1843,8 +1843,8 @@
mark_feed_as_read: function(feed_id) {
feed_id = feed_id || this.active_feed;
this.mark_feed_as_read_update_counts(feed_id);
this.model.mark_feed_as_read([feed_id]);
this.mark_feed_as_read_update_counts(feed_id);
if (feed_id == this.active_feed) {
this.model.stories.each(function(story) {
@ -1857,10 +1857,10 @@
var folder = folder || this.active_folder;
var feeds = folder.feed_ids_in_folder();
this.model.mark_feed_as_read(feeds);
_.each(feeds, _.bind(function(feed_id) {
this.mark_feed_as_read_update_counts(feed_id);
}, this));
this.model.mark_feed_as_read(feeds);
if (folder == this.active_folder) {
this.model.stories.each(function(story) {

View file

@ -5,15 +5,17 @@ NEWSBLUR.Views.FeedTitleView = Backbone.View.extend({
selected: false
},
flags: {},
events: {
"dblclick .feed_counts" : "mark_feed_as_read",
"dblclick" : "open_feed_link",
"click .NB-feedbar-mark-feed-read" : "mark_feed_as_read",
"click .NB-story-title-indicator" : "show_hidden_story_titles",
"click .NB-feedbar-train-feed" : "open_trainer",
"click .NB-feedbar-statistics" : "open_statistics",
"click .NB-feedlist-manage-icon" : "show_manage_menu",
"click .NB-feedbar-options" : "open_options_popover",
"dblclick .feed_counts" : "mark_feed_as_read",
"dblclick" : "open_feed_link",
"click" : "open",
"mouseenter" : "add_hover_inverse",
"mouseleave" : "remove_hover_inverse"
@ -231,7 +233,16 @@ NEWSBLUR.Views.FeedTitleView = Backbone.View.extend({
// = Events =
// ==========
open: function(e) {
open: function(e, options) {
options = options || {};
if (!options.ignore_double_click && $(e.target).closest('.feed_counts').length) {
_.delay(_.bind(function() {
if (!this.flags.double_click) {
this.open(e, {ignore_double_click: true});
}
}, this), 250);
return;
}
e.preventDefault();
e.stopPropagation();
if (this.options.feed_chooser) return;
@ -255,6 +266,11 @@ NEWSBLUR.Views.FeedTitleView = Backbone.View.extend({
if (this.options.type == "story") return;
if ($('.NB-modal-feedchooser').is(':visible')) return;
this.flags.double_click = true;
_.delay(_.bind(function() {
this.flags.double_click = false;
}, this), 500);
NEWSBLUR.reader.mark_feed_as_read(this.model.id);
window.open(this.model.get('feed_link'), '_blank');
window.focus();
@ -263,11 +279,17 @@ NEWSBLUR.Views.FeedTitleView = Backbone.View.extend({
},
mark_feed_as_read: function(e) {
NEWSBLUR.reader.mark_feed_as_read(this.model.id);
this.$('.NB-feedbar-mark-feed-read').fadeOut(400);
if (e) {
e.preventDefault();
e.stopPropagation();
}
this.flags.double_click = true;
_.delay(_.bind(function() {
this.flags.double_click = false;
}, this), 500);
NEWSBLUR.reader.mark_feed_as_read(this.model.id);
this.$('.NB-feedbar-mark-feed-read').fadeOut(400);
if (e) {
return false;
}
},