Correctly re-rendering story titles when switch into and out of grid layout.

This commit is contained in:
Samuel Clay 2015-02-10 17:04:32 -08:00
parent 23d32808f1
commit 4f4fd3f86c
5 changed files with 20 additions and 15 deletions

View file

@ -1891,22 +1891,26 @@ a img {
position: absolute;
left: 20px;
top: 0;
height: 12px;
height: 14px;
overflow: hidden;
width: 100px;
line-height: 1.3em;
}
.NB-theme-feed-size-xs #story_titles .NB-story-title .NB-story-feed .feed_title {
font-size: 9px;
height: 12px;
}
.NB-theme-feed-size-m #story_titles .NB-story-title .NB-story-feed .feed_title {
font-size: 11px;
height: 15px;
}
.NB-theme-feed-size-l #story_titles .NB-story-title .NB-story-feed .feed_title {
font-size: 12px;
height: 15px;
}
.NB-theme-feed-size-xl #story_titles .NB-story-title .NB-story-feed .feed_title {
font-size: 12px;
height: 15px;
}
#story_titles .NB-story-title.NB-selected .NB-story-feed .feed_title {

View file

@ -1542,7 +1542,7 @@
var original_layout = this.story_layout;
story_layout = story_layout || feed_layout || active_layout;
console.log(['switch_story_layout', active_layout, feed_layout, story_layout, this.active_feed, story_layout == active_layout]);
// console.log(['switch_story_layout', active_layout, feed_layout, story_layout, this.active_feed, story_layout == active_layout]);
if (story_layout == active_layout) return;
this.story_layout = story_layout;
@ -1554,30 +1554,30 @@
this.set_correct_story_view_for_feed();
this.apply_resizable_layout({right_side: true});
if (original_layout == 'grid' || story_layout == 'grid') {
NEWSBLUR.app.story_titles.render();
}
if (story_layout == 'list') {
if (this.active_story) {
this.active_story.story_title_view.render_inline_story_detail();
this.active_story.story_title_view.toggle_selected();
}
NEWSBLUR.app.story_list.clear();
} else if (story_layout == 'grid') {
if (this.active_story) {
this.active_story.story_title_view.render_inline_story_detail();
this.active_story.story_title_view.toggle_selected();
}
NEWSBLUR.app.story_list.clear();
} else if (story_layout == 'split') {
NEWSBLUR.app.story_list.render();
if (this.active_story) {
this.active_story.story_title_view.destroy_inline_story_detail();
this.active_story.story_title_view.toggle_selected();
}
} else if (story_layout == 'full') {
NEWSBLUR.app.story_list.render();
if (this.active_story) {
this.active_story.story_title_view.destroy_inline_story_detail();
this.active_story.story_title_view.toggle_selected();
}
}
if (original_layout == 'grid' || story_layout == 'grid') {
NEWSBLUR.app.story_titles.render();
}
this.switch_to_correct_view();
this.make_feed_title_in_stories();
@ -2785,7 +2785,7 @@
});
NEWSBLUR.app.story_list.reset_story_positions();
if (this.active_story &&
if (!options.resize && this.active_story &&
_.contains(['list', 'grid'],
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'))) {
NEWSBLUR.app.text_tab_view.unload();
@ -2807,7 +2807,7 @@
if (!this.active_story) {
NEWSBLUR.app.text_tab_view.show_explainer_single_story_mode();
}
} else if (this.active_story &&
} else if (!options.resize && this.active_story &&
_.contains(['list', 'grid'],
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'))) {
this.active_story.story_title_view.render_inline_story_detail();
@ -4200,7 +4200,7 @@
});
}
$(".NB-feeds-list-empty").remove();
console.log(["toggle_focus_in_slider", unread_view, view_not_empty, starred_mode]);
// console.log(["toggle_focus_in_slider", unread_view, view_not_empty, starred_mode]);
if (!view_not_empty && !all_mode && !starred_mode) {
var $empty = $.make("div", { className: "NB-feeds-list-empty" }, [
'You have no unread stories',

View file

@ -419,7 +419,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
]);
this.$('.NB-feed-story-premium-only').remove();
this.$(".NB-end-line").append($notice);
console.log(["append_search_premium_only_notification", this.$(".NB-end-line")]);
// console.log(["append_search_premium_only_notification", this.$(".NB-end-line")]);
},
append_search_premium_only_notification: function() {

View file

@ -25,6 +25,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
render: function() {
var template_name = !this.model.get('selected') && this.options.is_grid ?
'grid_template' : 'template';
// console.log(['render story title', template_name, this.$el[0]]);
this.$el.html(this[template_name]({
story : this.model,
feed : (NEWSBLUR.reader.flags.river_view || NEWSBLUR.reader.flags.social_view) &&
@ -133,6 +134,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
tagName: 'div',
inline_story_title: true
}).render();
// console.log(['render_inline_story_detail', this.$(".NB-story-detail")]);
this.$(".NB-story-detail").html(this.story_detail.$el);
this.story_detail.attach_handlers();
}
@ -298,7 +300,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
this.$st.toggleClass('NB-selected', !!this.model.get('selected'));
this.$el.toggleClass('NB-selected', !!this.model.get('selected'));
if (selected) {
if (!!this.model.get('selected')) {
if (_.contains(['list', 'grid'], NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'))) {
this.render_inline_story_detail();
}

View file

@ -75,7 +75,6 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
override_grid: function() {
if (NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout') != 'grid') return;
console.log(['override_grid', NEWSBLUR.assets.preference('grid_columns')]);
var columns = NEWSBLUR.assets.preference('grid_columns');
var $layout = NEWSBLUR.reader.$s.$story_titles;
$layout.removeClass('NB-grid-columns-1')