2021-01-12 20:15:42 -05:00
|
|
|
NEWSBLUR.Views.DashboardRivers = Backbone.View.extend({
|
|
|
|
|
|
|
|
el: ".NB-dashboard-rivers",
|
|
|
|
|
|
|
|
options: {
|
|
|
|
side: 'left'
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
var side = this.options.side;
|
|
|
|
this.setElement($(".NB-dashboard-rivers-" + side));
|
2021-01-13 19:59:22 -05:00
|
|
|
this.$el.empty();
|
2021-01-12 20:15:42 -05:00
|
|
|
this.rivers = NEWSBLUR.assets.dashboard_rivers.side(side).map(_.bind(function (river, r) {
|
|
|
|
var river_view = new NEWSBLUR.Views.DashboardRiver({
|
|
|
|
dashboard_stories: new NEWSBLUR.Collections.Stories(),
|
|
|
|
model: river
|
|
|
|
});
|
2021-04-06 19:24:54 -04:00
|
|
|
// console.log(['Adding river', side, river.get('river_id'), river_view, river_view.$el, this.$el])
|
2021-01-12 20:15:42 -05:00
|
|
|
this.$el.append(river_view.$el);
|
2021-01-13 15:40:31 -05:00
|
|
|
|
|
|
|
return river_view;
|
2021-01-12 20:15:42 -05:00
|
|
|
}, this));
|
2021-01-13 15:40:31 -05:00
|
|
|
|
|
|
|
return this;
|
2021-01-12 20:15:42 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
load_all_stories: function () {
|
2021-01-13 15:40:31 -05:00
|
|
|
this.rivers.forEach(function (r) { return r.load_stories(); });
|
2021-01-12 20:15:42 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
new_story: function (story_hash, timestamp) {
|
2021-01-13 15:40:31 -05:00
|
|
|
this.rivers.forEach(function (r) { r.new_story(story_hash, timestamp); });
|
2021-01-12 20:15:42 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
mark_read_pubsub: function (story_hash) {
|
2021-01-13 15:40:31 -05:00
|
|
|
this.rivers.forEach(function (r) {
|
2021-01-12 20:15:42 -05:00
|
|
|
r.options.dashboard_stories.mark_read_pubsub(story_hash);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
mark_unread_pubsub: function (story_hash) {
|
2021-01-13 15:40:31 -05:00
|
|
|
this.rivers.forEach(function (r) {
|
2021-01-12 20:15:42 -05:00
|
|
|
r.options.dashboard_stories.mark_unread_pubsub(story_hash);
|
|
|
|
});
|
2021-01-14 20:13:57 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
redraw: function () {
|
|
|
|
this.rivers.forEach(function (r) { return r.redraw(); });
|
2021-01-12 20:15:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|