Set default for newly added blocks to 'left', for existing blocks to 'none'

[MAILPOET-2491]
This commit is contained in:
Jan Jakeš
2020-02-12 16:34:19 +01:00
committed by Jack Kitterhing
parent 15b166d188
commit 499c14e0a3
2 changed files with 14 additions and 4 deletions

View File

@@ -68,7 +68,7 @@ Module.AutomatedLatestContentLayoutBlockModel = base.BlockModel.extend({
imageFullWidth: false, // true|false
titlePosition: 'abovePost', // 'abovePost'|'aboveExcerpt'
featuredImagePosition: 'centered', // 'centered'|'left'|'right'|'alternate'|'none'
fullPostFeaturedImagePosition: 'left', // 'centered'|'left'|'right'|'alternate'|'none'
fullPostFeaturedImagePosition: 'none', // 'centered'|'left'|'right'|'alternate'|'none'
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
authorPrecededBy: 'Author:',
showCategories: 'no', // 'no'|'aboveText'|'belowText'
@@ -94,7 +94,12 @@ Module.AutomatedLatestContentLayoutBlockModel = base.BlockModel.extend({
_container: App.getBlockTypeModel('container'),
};
},
initialize: function () {
initialize: function (block) {
// when added as new block, set default for full post featured image position to 'left'
if (_.isEmpty(block)) {
this.set('fullPostFeaturedImagePosition', 'left');
}
base.BlockView.prototype.initialize.apply(this, arguments);
this.on('change:amount change:contentType change:terms change:inclusionType change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:sortBy change:showDivider change:titlePosition', this._handleChanges, this);
this.listenTo(this.get('readMoreButton'), 'change', this._handleChanges);

View File

@@ -52,7 +52,7 @@ Module.PostsBlockModel = base.BlockModel.extend({
imageFullWidth: false, // true|false
titlePosition: 'abovePost', // 'abovePost'|'aboveExcerpt'
featuredImagePosition: 'centered', // 'centered'|'right'|'left'|'alternate'|'none'
fullPostFeaturedImagePosition: 'left', // 'centered'|'left'|'right'|'alternate'|'none'
fullPostFeaturedImagePosition: 'none', // 'centered'|'left'|'right'|'alternate'|'none'
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
authorPrecededBy: 'Author:',
showCategories: 'no', // 'no'|'aboveText'|'belowText'
@@ -81,7 +81,7 @@ Module.PostsBlockModel = base.BlockModel.extend({
_transformedPosts: App.getBlockTypeModel('container'),
};
},
initialize: function () {
initialize: function (block) {
var POST_REFRESH_DELAY_MS = 500;
var refreshAvailablePosts = _.debounce(
this.fetchAvailablePosts.bind(this),
@@ -92,6 +92,11 @@ Module.PostsBlockModel = base.BlockModel.extend({
POST_REFRESH_DELAY_MS
);
// when added as new block, set default for full post featured image position to 'left'
if (_.isEmpty(block)) {
this.set('fullPostFeaturedImagePosition', 'left');
}
// Attach Radio.Requests API primarily for highlighting
_.extend(this, Radio.Requests);