Switch post display types using backbone views, instead of manually
[MAILPOET-2491]
This commit is contained in:
committed by
Jack Kitterhing
parent
d592e9e1a6
commit
515131e55d
@ -307,33 +307,14 @@ Module.AutomatedLatestContentLayoutBlockSettingsView = base.BlockSettingsView.ex
|
|||||||
changeDisplayType: function (event) {
|
changeDisplayType: function (event) {
|
||||||
var value = jQuery(event.target).val();
|
var value = jQuery(event.target).val();
|
||||||
|
|
||||||
if (value === 'titleOnly') {
|
// Reset titleFormat if it was set to List when switching away from displayType=titleOnly
|
||||||
this.$('.mailpoet_automated_latest_content_title_as_list').removeClass('mailpoet_hidden');
|
if (value !== 'titleOnly' && this.model.get('titleFormat') === 'ul') {
|
||||||
this.$('.mailpoet_automated_latest_content_image_full_width_option').addClass('mailpoet_hidden');
|
this.model.set('titleFormat', 'h1');
|
||||||
this.$('.mailpoet_automated_latest_content_image_separator').addClass('mailpoet_hidden');
|
this.$('.mailpoet_automated_latest_content_title_format').val(['h1']);
|
||||||
} else {
|
this.$('.mailpoet_automated_latest_content_title_as_link').removeClass('mailpoet_hidden');
|
||||||
this.$('.mailpoet_automated_latest_content_title_as_list').addClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_automated_latest_content_image_full_width_option').removeClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_automated_latest_content_image_separator').removeClass('mailpoet_hidden');
|
|
||||||
|
|
||||||
// Reset titleFormat if it was set to List when switching away from displayType=titleOnly
|
|
||||||
if (this.model.get('titleFormat') === 'ul') {
|
|
||||||
this.model.set('titleFormat', 'h1');
|
|
||||||
this.$('.mailpoet_automated_latest_content_title_format').val(['h1']);
|
|
||||||
this.$('.mailpoet_automated_latest_content_title_as_link').removeClass('mailpoet_hidden');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value === 'excerpt') {
|
|
||||||
this.$('.mailpoet_automated_latest_content_featured_image_position_container').removeClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_automated_latest_content_title_position_separator').removeClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_automated_latest_content_title_position').removeClass('mailpoet_hidden');
|
|
||||||
} else {
|
|
||||||
this.$('.mailpoet_automated_latest_content_featured_image_position_container').addClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_automated_latest_content_title_position_separator').addClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_automated_latest_content_title_position').addClass('mailpoet_hidden');
|
|
||||||
}
|
}
|
||||||
this.changeField('displayType', event);
|
this.changeField('displayType', event);
|
||||||
|
this.render();
|
||||||
},
|
},
|
||||||
changeTitleFormat: function (event) {
|
changeTitleFormat: function (event) {
|
||||||
var value = jQuery(event.target).val();
|
var value = jQuery(event.target).val();
|
||||||
|
@ -533,30 +533,15 @@ PostsDisplayOptionsSettingsView = base.BlockSettingsView.extend({
|
|||||||
},
|
},
|
||||||
changeDisplayType: function (event) {
|
changeDisplayType: function (event) {
|
||||||
var value = jQuery(event.target).val();
|
var value = jQuery(event.target).val();
|
||||||
if (value === 'titleOnly') {
|
|
||||||
this.$('.mailpoet_posts_title_as_list').removeClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_posts_image_full_width_option').addClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_posts_image_separator').addClass('mailpoet_hidden');
|
|
||||||
} else {
|
|
||||||
this.$('.mailpoet_posts_title_as_list').addClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_posts_image_full_width_option').removeClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_posts_image_separator').removeClass('mailpoet_hidden');
|
|
||||||
|
|
||||||
// Reset titleFormat if it was set to List when switching away from displayType=titleOnly
|
// Reset titleFormat if it was set to List when switching away from displayType=titleOnly
|
||||||
if (this.model.get('titleFormat') === 'ul') {
|
if (value !== 'titleOnly' && this.model.get('titleFormat') === 'ul') {
|
||||||
this.model.set('titleFormat', 'h1');
|
this.model.set('titleFormat', 'h1');
|
||||||
this.$('.mailpoet_posts_title_format').val(['h1']);
|
this.$('.mailpoet_posts_title_format').val(['h1']);
|
||||||
this.$('.mailpoet_posts_title_as_link').removeClass('mailpoet_hidden');
|
this.$('.mailpoet_posts_title_as_link').removeClass('mailpoet_hidden');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value === 'excerpt') {
|
|
||||||
this.$('.mailpoet_posts_featured_image_position_container').removeClass('mailpoet_hidden');
|
|
||||||
} else {
|
|
||||||
this.$('.mailpoet_posts_featured_image_position_container').addClass('mailpoet_hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.changeField('displayType', event);
|
this.changeField('displayType', event);
|
||||||
|
this.render();
|
||||||
},
|
},
|
||||||
changeTitleFormat: function (event) {
|
changeTitleFormat: function (event) {
|
||||||
var value = jQuery(event.target).val();
|
var value = jQuery(event.target).val();
|
||||||
|
Reference in New Issue
Block a user