mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Separating dashboard river and regularly stories.
This commit is contained in:
parent
9ec30fcfe8
commit
52db1011a9
6 changed files with 34 additions and 10 deletions
|
@ -765,8 +765,8 @@ def load_single_feed(request, feed_id):
|
|||
|
||||
# if page <= 3:
|
||||
# import random
|
||||
# time.sleep(random.randint(2, 7) / 10.0)
|
||||
# # time.sleep(random.randint(2, 14))
|
||||
# # time.sleep(random.randint(2, 7) / 10.0)
|
||||
# time.sleep(random.randint(10, 14))
|
||||
|
||||
# if page == 2:
|
||||
# assert False
|
||||
|
|
|
@ -689,6 +689,7 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
|||
'ajax_group': (page ? 'feed_page' : 'feed'),
|
||||
'request_type': 'GET'
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
fetch_dashboard_stories: function(feed_id, feeds, callback, error_callback) {
|
||||
|
|
|
@ -118,7 +118,10 @@
|
|||
});
|
||||
NEWSBLUR.app.sidebar = new NEWSBLUR.Views.Sidebar();
|
||||
NEWSBLUR.app.feed_list = new NEWSBLUR.Views.FeedList({el: this.$s.$feed_list[0]});
|
||||
NEWSBLUR.app.story_titles = new NEWSBLUR.Views.StoryTitlesView({collection: NEWSBLUR.assets.stories});
|
||||
NEWSBLUR.app.story_titles = new NEWSBLUR.Views.StoryTitlesView({
|
||||
el: this.$s.$story_titles,
|
||||
collection: NEWSBLUR.assets.stories
|
||||
});
|
||||
NEWSBLUR.app.story_list = new NEWSBLUR.Views.StoryListView({collection: NEWSBLUR.assets.stories});
|
||||
NEWSBLUR.app.original_tab_view = new NEWSBLUR.Views.OriginalTabView({collection: NEWSBLUR.assets.stories});
|
||||
NEWSBLUR.app.story_tab_view = new NEWSBLUR.Views.StoryTabView({collection: NEWSBLUR.assets.stories});
|
||||
|
|
|
@ -9,9 +9,11 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
|
|||
initialize: function() {
|
||||
this.$stories = this.$(".NB-module-item");
|
||||
this.story_titles = new NEWSBLUR.Views.StoryTitlesView({
|
||||
el: this.$stories,
|
||||
collection: NEWSBLUR.assets.dashboard_stories,
|
||||
$story_titles: this.$stories,
|
||||
override_layout: 'split'
|
||||
override_layout: 'split',
|
||||
on_dashboard: true
|
||||
});
|
||||
// this.$stories.html(this.story_titles.$el);
|
||||
|
||||
|
@ -30,7 +32,7 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
|
|||
},
|
||||
|
||||
post_load_stories: function() {
|
||||
console.log(['$story_title', this.story_titles.el, this.$stories[0], NEWSBLUR.reader.$s.$story_titles[0]]);
|
||||
|
||||
}
|
||||
|
||||
});
|
|
@ -461,6 +461,11 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
e.stopPropagation();
|
||||
if (e.which == 1 && $('.NB-menu-manage-container:visible').length) return;
|
||||
|
||||
if (this.options.on_dashboard) {
|
||||
console.log(['clicked story', this.model]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_.contains(['list', 'grid'], this.options.override_layout ||
|
||||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout')) &&
|
||||
this.model.get('selected')) {
|
||||
|
@ -498,6 +503,10 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
show_manage_menu: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (this.options.on_dashboard) {
|
||||
return this.select_story(e);
|
||||
}
|
||||
|
||||
// NEWSBLUR.log(["showing manage menu", this.model.is_social() ? 'socialfeed' : 'feed', $(this.el), this]);
|
||||
NEWSBLUR.reader.show_manage_menu('story', this.$st, {
|
||||
story_id: this.model.id,
|
||||
|
@ -522,6 +531,10 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
open_story_in_story_view: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (this.options.on_dashboard) {
|
||||
return this.select_story(e);
|
||||
}
|
||||
|
||||
NEWSBLUR.app.story_tab_view.prepare_story(this.model, true);
|
||||
NEWSBLUR.app.story_tab_view.open_story(this.model);
|
||||
return false;
|
||||
|
|
|
@ -26,18 +26,22 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
|
|||
// ==========
|
||||
|
||||
render: function() {
|
||||
// console.log(['render story_titles', this.options.override_layout, this.collection.length, this.$story_titles[0]]);
|
||||
this.clear();
|
||||
this.$story_titles.scrollTop(0);
|
||||
var collection = this.collection;
|
||||
var stories = this.collection.map(_.bind(function(story) {
|
||||
var story_layout = this.options.override_layout ||
|
||||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
|
||||
var on_dashboard = this.options.on_dashboard;
|
||||
var stories = this.collection.map(function(story) {
|
||||
return new NEWSBLUR.Views.StoryTitleView({
|
||||
model: story,
|
||||
collection: collection,
|
||||
is_grid: this.options.override_layout == 'grid' ||
|
||||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout') == 'grid',
|
||||
override_layout: this.options.override_layout
|
||||
is_grid: story_layout == 'grid',
|
||||
override_layout: story_layout,
|
||||
on_dashboard: on_dashboard
|
||||
}).render();
|
||||
}, this));
|
||||
});
|
||||
this.stories = stories;
|
||||
var $stories = _.map(stories, function(story) {
|
||||
return story.el;
|
||||
|
@ -51,6 +55,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
add: function(options) {
|
||||
// console.log(['add story_titles', options]);
|
||||
var collection = this.collection;
|
||||
if (options.added) {
|
||||
var stories = _.compact(_.map(this.collection.models.slice(-1 * options.added), _.bind(function(story) {
|
||||
|
|
Loading…
Add table
Reference in a new issue