Dashboard stories are now loading! Need to add all types of folders, then the configuration popover.

This commit is contained in:
Samuel Clay 2020-12-11 18:47:37 -05:00
parent 6b43f5a9e6
commit f52090b68e
5 changed files with 22 additions and 14 deletions

View file

@ -5289,7 +5289,7 @@ form.opml_import_form input {
bottom: 0;
right: 0;
overflow-y: auto;
margin: 0 0 32px;
padding: 0 0 32px;
}
.NB-splash-modules {
@ -5319,6 +5319,8 @@ form.opml_import_form input {
border-top: 1px solid rgba(0,0,0,0.1);
height: 30px;
overflow: hidden;
background: rgba(243, 245, 241, .7);
backdrop-filter: blur(5px);
}
.NB-splash-info .NB-splash-title {
position: absolute;

View file

@ -791,7 +791,7 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
dashboard_stories.reset(data.stories, {added: data.stories.length});
}
callback();
callback(data);
};
if (_.string.startsWith(feed_id, 'river:global')) {

View file

@ -4678,7 +4678,7 @@
NEWSBLUR.app.dashboard_rivers = NEWSBLUR.assets.dashboard_rivers.map(function (river, r) {
return new NEWSBLUR.Views.DashboardRiver({
el: '.NB-module-'+river.get('river_side')+'-river-' + river.get('river_order'),
active_feed: river.id,
active_feed: river.get('river_id'),
active_folder: NEWSBLUR.assets.folders,
dashboard_stories: new NEWSBLUR.Collections.Stories(),
side: river.get('river_side'),
@ -4692,19 +4692,19 @@
var sides = existing_rivers.count_sides();
if (!existing_rivers.contains(function (river) {
river.id == "river:";
river.get('river_id') == "river:";
})) {
NEWSBLUR.assets.save_dashboard_river("river:", "left", 0);
}
if (!existing_rivers.contains(function (river) {
river.id == "river:infrequent";
river.get('river_id') == "river:infrequent";
})) {
NEWSBLUR.assets.save_dashboard_river("river:infrequent", "left", 1);
}
if (!existing_rivers.contains(function (river) {
river.id == "river:global";
river.get('river_id') == "river:global";
})) {
NEWSBLUR.assets.save_dashboard_river("river:global", "left", 2);
}

View file

@ -9,18 +9,20 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
initialize: function () {
var $dashboard_side = $(".NB-dashboard-rivers-" + this.model.get('river_side'));
var $river_on_dashboard = $dashboard_side.find(".NB-dashboard-river-order-" + this.model.get('river_order'));
var $river = this.template();
if ($river_on_dashboard.length) {
this.$el = $river_on_dashboard;
$river_on_dashboard.replaceWith($river);
} else {
var $river = this.template();
$dashboard_side.append($river);
this.$el = $river;
}
this.$el = $river;
this.$stories = this.$(".NB-module-item .NB-story-titles");
console.log('dashboard stories', this.options.el, this.$stories, this.options);
// console.log(['dashboard stories view', this.$stories, this.options, this.$stories.el]);
this.story_titles = new NEWSBLUR.Views.StoryTitlesView({
el: this.$stories,
el: this.$stories.get(0),
collection: this.options.dashboard_stories,
$story_titles: this.$stories,
override_layout: 'split',
@ -42,6 +44,7 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
// NEWSBLUR.assets.stories.bind('change:selected', this.check_read_stories, this);
this.setup_dashboard_refresh();
this.load_stories();
},
template: function () {
@ -133,7 +136,7 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
var feeds = this.feeds();
if (!feeds.length) return;
if (!this.$stories.length) return;
console.log(['dashboard river load_stories', this.page, feeds.length, options]);
// console.log(['dashboard river load_stories', this.page, feeds.length, options]);
this.page = 1;
this.story_titles.show_loading();
NEWSBLUR.assets.fetch_dashboard_stories(this.options.active_feed, feeds, this.page, this.options.dashboard_stories, options,
@ -142,7 +145,8 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
this.setup_dashboard_refresh();
},
post_load_stories: function() {
post_load_stories: function (stories) {
// console.log(['post_load_stories', this.model.get('river_id'), this.options.dashboard_stories.length, stories])
this.fill_out();
this.cache.story_hashes = this.options.dashboard_stories.pluck('story_hash');
},
@ -160,7 +164,7 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
}
var visible = this.options.dashboard_stories.visible().length;
console.log("Visible", visible, options)
// console.log("Visible", visible, options)
if (visible >= 3 && !NEWSBLUR.Globals.is_premium) {
this.story_titles.check_premium_river();
this.complete_fill();

View file

@ -11,6 +11,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
initialize: function() {
_.bindAll(this, 'scroll');
// console.log(['initialize story titles view', this.collection]);
this.collection.bind('reset', this.render, this);
this.collection.bind('add', this.add, this);
this.collection.bind('no_more_stories', this.check_premium_river, this);
@ -48,6 +49,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
return story.el;
});
this.$el.html($stories);
// console.log(['Rendered story titles', this.$el, $stories]);
this.end_loading();
this.fill_out();
this.override_grid();