NewsBlur/media/js/newsblur/models/feeds.js

57 lines
1.2 KiB
JavaScript
Raw Normal View History

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