Fixing selected issues with starred feed titles when reseting feeds.

This commit is contained in:
Samuel Clay 2013-09-09 17:16:26 -07:00
parent aa96458ae3
commit e7c1b06c4f
3 changed files with 11 additions and 6 deletions

View file

@ -228,9 +228,15 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
mark_story_as_starred: function(story_id, callback) {
var self = this;
var story = this.get_story(story_id);
var selected = this.starred_feeds.selected();
var pre_callback = function(data) {
self.starred_feeds.reset(data.starred_counts, {parse: true, update: true});
self.starred_feeds.reset(data.starred_counts, {parse: true});
if (selected) {
self.starred_feeds.get(selected).set('selected', true);
}
if (callback) callback(data);
};
@ -246,7 +252,7 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
var story = this.get_story(story_id);
var pre_callback = function(data) {
self.starred_feeds.reset(data.starred_counts, {parse: true, update: true});
self.starred_feeds.reset(data.starred_counts, {parse: true});
if (callback) callback(data);
};

View file

@ -3,7 +3,6 @@ NEWSBLUR.Models.StarredFeed = Backbone.Model.extend({
initialize: function() {
this.set('feed_title', this.get('tag'));
this.views = [];
this.id = 'starred:' + this.get('tag');
},
is_social: function() {
@ -38,8 +37,8 @@ NEWSBLUR.Collections.StarredFeeds = Backbone.Collection.extend({
parse: function(models) {
_.each(models, function(feed) {
feed.id = feed.tag;
feed.selected = false;
feed.id = 'starred:' + feed.tag;
// feed.selected = false;
feed.ps = feed.count;
});
return models;

View file

@ -98,7 +98,7 @@ NEWSBLUR.Views.FeedTitleView = Backbone.View.extend({
extra_classes : extra_classes,
toplevel : this.options.depth == 0,
list_type : this.options.type == 'feed' ? 'li' : 'div',
selected : this.model.get('selected') || NEWSBLUR.reader.active_feed == this.model.id
selected : this.model.get('selected')
}));
if (this.options.type == 'story') {