mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-31 22:20:12 +00:00
Fixing selected issues with starred feed titles when reseting feeds.
This commit is contained in:
parent
aa96458ae3
commit
e7c1b06c4f
3 changed files with 11 additions and 6 deletions
|
@ -228,9 +228,15 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
||||||
mark_story_as_starred: function(story_id, callback) {
|
mark_story_as_starred: function(story_id, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var story = this.get_story(story_id);
|
var story = this.get_story(story_id);
|
||||||
|
var selected = this.starred_feeds.selected();
|
||||||
|
|
||||||
var pre_callback = function(data) {
|
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);
|
if (callback) callback(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -246,7 +252,7 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
||||||
var story = this.get_story(story_id);
|
var story = this.get_story(story_id);
|
||||||
|
|
||||||
var pre_callback = function(data) {
|
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);
|
if (callback) callback(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ NEWSBLUR.Models.StarredFeed = Backbone.Model.extend({
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.set('feed_title', this.get('tag'));
|
this.set('feed_title', this.get('tag'));
|
||||||
this.views = [];
|
this.views = [];
|
||||||
this.id = 'starred:' + this.get('tag');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
is_social: function() {
|
is_social: function() {
|
||||||
|
@ -38,8 +37,8 @@ NEWSBLUR.Collections.StarredFeeds = Backbone.Collection.extend({
|
||||||
|
|
||||||
parse: function(models) {
|
parse: function(models) {
|
||||||
_.each(models, function(feed) {
|
_.each(models, function(feed) {
|
||||||
feed.id = feed.tag;
|
feed.id = 'starred:' + feed.tag;
|
||||||
feed.selected = false;
|
// feed.selected = false;
|
||||||
feed.ps = feed.count;
|
feed.ps = feed.count;
|
||||||
});
|
});
|
||||||
return models;
|
return models;
|
||||||
|
|
|
@ -98,7 +98,7 @@ NEWSBLUR.Views.FeedTitleView = Backbone.View.extend({
|
||||||
extra_classes : extra_classes,
|
extra_classes : extra_classes,
|
||||||
toplevel : this.options.depth == 0,
|
toplevel : this.options.depth == 0,
|
||||||
list_type : this.options.type == 'feed' ? 'li' : 'div',
|
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') {
|
if (this.options.type == 'story') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue