2012-05-17 18:40:46 -07:00
|
|
|
NEWSBLUR.Models.Feed = Backbone.Model.extend({
|
|
|
|
|
2012-05-22 17:39:21 -07:00
|
|
|
initialize: function() {
|
|
|
|
_.bindAll(this, 'on_change');
|
|
|
|
this.bind('change', this.on_change);
|
2012-05-23 10:02:30 -07:00
|
|
|
this.views = [];
|
2012-05-22 17:39:21 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
on_change: function() {
|
2012-05-23 10:02:30 -07:00
|
|
|
// NEWSBLUR.log(['Feed Change', this.changedAttributes(), this.previousAttributes()]);
|
2012-05-22 17:39:21 -07:00
|
|
|
},
|
|
|
|
|
2012-05-18 16:59:39 -07:00
|
|
|
is_social: function() {
|
|
|
|
return false;
|
2012-05-22 17:39:21 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
is_feed: function() {
|
|
|
|
return true;
|
2012-05-18 16:59:39 -07:00
|
|
|
}
|
|
|
|
|
2012-05-17 18:40:46 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
NEWSBLUR.Collections.Feeds = Backbone.Collection.extend({
|
|
|
|
|
|
|
|
model: NEWSBLUR.Models.Feed,
|
|
|
|
|
|
|
|
url: '/reader/feeds',
|
|
|
|
|
|
|
|
fetch: function(options) {
|
|
|
|
options = _.extend({
|
|
|
|
data: {
|
|
|
|
v: 2
|
2012-05-17 20:50:08 -07:00
|
|
|
},
|
|
|
|
silent: true
|
2012-05-17 18:40:46 -07:00
|
|
|
}, options);
|
|
|
|
return Backbone.Collection.prototype.fetch.call(this, options);
|
|
|
|
},
|
|
|
|
|
|
|
|
parse: function(data) {
|
|
|
|
return data.feeds;
|
2012-05-18 18:13:45 -07:00
|
|
|
},
|
2012-05-17 18:40:46 -07:00
|
|
|
|
2012-05-18 18:13:45 -07:00
|
|
|
has_chosen_feeds: function() {
|
|
|
|
return this.any(function(feed) {
|
|
|
|
return feed.get('active');
|
|
|
|
});
|
2012-05-21 20:08:27 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
deselect: function() {
|
|
|
|
this.chain().select(function(feed) {
|
|
|
|
return feed.get('selected');
|
|
|
|
}).each(function(feed){
|
|
|
|
feed.set('selected', false);
|
|
|
|
});
|
2012-05-18 18:13:45 -07:00
|
|
|
}
|
2012-05-17 18:40:46 -07:00
|
|
|
|
|
|
|
});
|