Change title position to featured image position
This commit is contained in:
@ -32,10 +32,10 @@ define([
|
|||||||
inclusionType: 'include', // 'include'|'exclude'
|
inclusionType: 'include', // 'include'|'exclude'
|
||||||
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
||||||
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
||||||
titlePosition: 'inTextBlock', // 'inTextBlock'|'aboveBlock',
|
|
||||||
titleAlignment: 'left', // 'left'|'center'|'right'
|
titleAlignment: 'left', // 'left'|'center'|'right'
|
||||||
titleIsLink: false, // false|true
|
titleIsLink: false, // false|true
|
||||||
imageFullWidth: false, // true|false
|
imageFullWidth: false, // true|false
|
||||||
|
featuredImagePosition: 'belowTitle', // 'aboveTitle'|'belowTitle'|'none'
|
||||||
//imageAlignment: 'centerPadded', // 'centerFull'|'centerPadded'|'left'|'right'|'alternate'|'none'
|
//imageAlignment: 'centerPadded', // 'centerFull'|'centerPadded'|'left'|'right'|'alternate'|'none'
|
||||||
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: 'Author:',
|
authorPrecededBy: 'Author:',
|
||||||
@ -63,7 +63,7 @@ define([
|
|||||||
initialize: function() {
|
initialize: function() {
|
||||||
base.BlockView.prototype.initialize.apply(this, arguments);
|
base.BlockView.prototype.initialize.apply(this, arguments);
|
||||||
this.fetchPosts();
|
this.fetchPosts();
|
||||||
this.on('change:amount change:contentType change:terms change:inclusionType change:displayType change:titleFormat change:titlePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:sortBy change:showDivider', this._scheduleFetchPosts, this);
|
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', this._scheduleFetchPosts, this);
|
||||||
this.listenTo(this.get('readMoreButton'), 'change', this._scheduleFetchPosts);
|
this.listenTo(this.get('readMoreButton'), 'change', this._scheduleFetchPosts);
|
||||||
this.listenTo(this.get('divider'), 'change', this._scheduleFetchPosts);
|
this.listenTo(this.get('divider'), 'change', this._scheduleFetchPosts);
|
||||||
},
|
},
|
||||||
@ -142,9 +142,9 @@ define([
|
|||||||
"keyup .mailpoet_automated_latest_content_show_amount": _.partial(this.changeField, "amount"),
|
"keyup .mailpoet_automated_latest_content_show_amount": _.partial(this.changeField, "amount"),
|
||||||
"change .mailpoet_automated_latest_content_content_type": _.partial(this.changeField, "contentType"),
|
"change .mailpoet_automated_latest_content_content_type": _.partial(this.changeField, "contentType"),
|
||||||
"change .mailpoet_automated_latest_content_include_or_exclude": _.partial(this.changeField, "inclusionType"),
|
"change .mailpoet_automated_latest_content_include_or_exclude": _.partial(this.changeField, "inclusionType"),
|
||||||
"change .mailpoet_automated_latest_content_title_position": _.partial(this.changeField, "titlePosition"),
|
|
||||||
"change .mailpoet_automated_latest_content_title_alignment": _.partial(this.changeField, "titleAlignment"),
|
"change .mailpoet_automated_latest_content_title_alignment": _.partial(this.changeField, "titleAlignment"),
|
||||||
"change .mailpoet_automated_latest_content_image_full_width": _.partial(this.changeBoolField, "imageFullWidth"),
|
"change .mailpoet_automated_latest_content_image_full_width": _.partial(this.changeBoolField, "imageFullWidth"),
|
||||||
|
"change .mailpoet_automated_latest_content_featured_image_position": _.partial(this.changeField, "featuredImagePosition"),
|
||||||
"change .mailpoet_automated_latest_content_show_author": _.partial(this.changeField, "showAuthor"),
|
"change .mailpoet_automated_latest_content_show_author": _.partial(this.changeField, "showAuthor"),
|
||||||
"keyup .mailpoet_automated_latest_content_author_preceded_by": _.partial(this.changeField, "authorPrecededBy"),
|
"keyup .mailpoet_automated_latest_content_author_preceded_by": _.partial(this.changeField, "authorPrecededBy"),
|
||||||
"change .mailpoet_automated_latest_content_show_categories": _.partial(this.changeField, "showCategories"),
|
"change .mailpoet_automated_latest_content_show_categories": _.partial(this.changeField, "showCategories"),
|
||||||
@ -273,12 +273,13 @@ define([
|
|||||||
},
|
},
|
||||||
changeDisplayType: function(event) {
|
changeDisplayType: function(event) {
|
||||||
var value = jQuery(event.target).val();
|
var value = jQuery(event.target).val();
|
||||||
|
|
||||||
if (value == 'titleOnly') {
|
if (value == 'titleOnly') {
|
||||||
this.$('.mailpoet_automated_latest_content_title_position_container').addClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_automated_latest_content_title_as_list').removeClass('mailpoet_hidden');
|
this.$('.mailpoet_automated_latest_content_title_as_list').removeClass('mailpoet_hidden');
|
||||||
|
this.$('.mailpoet_automated_latest_content_image_full_width_option').addClass('mailpoet_hidden');
|
||||||
} else {
|
} else {
|
||||||
this.$('.mailpoet_automated_latest_content_title_position_container').removeClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_automated_latest_content_title_as_list').addClass('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');
|
||||||
|
|
||||||
// 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 (this.model.get('titleFormat') === 'ul') {
|
||||||
@ -287,6 +288,12 @@ define([
|
|||||||
this.$('.mailpoet_automated_latest_content_title_as_link').removeClass('mailpoet_hidden');
|
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');
|
||||||
|
} else {
|
||||||
|
this.$('.mailpoet_automated_latest_content_featured_image_position_container').addClass('mailpoet_hidden');
|
||||||
|
}
|
||||||
this.changeField('displayType', event);
|
this.changeField('displayType', event);
|
||||||
},
|
},
|
||||||
changeTitleFormat: function(event) {
|
changeTitleFormat: function(event) {
|
||||||
|
@ -43,10 +43,10 @@ define([
|
|||||||
inclusionType: 'include', // 'include'|'exclude'
|
inclusionType: 'include', // 'include'|'exclude'
|
||||||
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
||||||
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
||||||
titlePosition: 'inTextBlock', // 'inTextBlock'|'aboveBlock',
|
|
||||||
titleAlignment: 'left', // 'left'|'center'|'right'
|
titleAlignment: 'left', // 'left'|'center'|'right'
|
||||||
titleIsLink: false, // false|true
|
titleIsLink: false, // false|true
|
||||||
imageFullWidth: false, // true|false
|
imageFullWidth: false, // true|false
|
||||||
|
featuredImagePosition: 'belowTitle', // 'aboveTitle'|'belowTitle'|'none'
|
||||||
//imageAlignment: 'centerPadded', // 'centerFull'|'centerPadded'|'left'|'right'|'alternate'|'none'
|
//imageAlignment: 'centerPadded', // 'centerFull'|'centerPadded'|'left'|'right'|'alternate'|'none'
|
||||||
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: 'Author:',
|
authorPrecededBy: 'Author:',
|
||||||
@ -88,7 +88,7 @@ define([
|
|||||||
this.on('change:amount change:contentType change:terms change:inclusionType change:postStatus change:search change:sortBy', refreshAvailablePosts);
|
this.on('change:amount change:contentType change:terms change:inclusionType change:postStatus change:search change:sortBy', refreshAvailablePosts);
|
||||||
|
|
||||||
this.listenTo(this.get('_selectedPosts'), 'add remove reset', refreshTransformedPosts);
|
this.listenTo(this.get('_selectedPosts'), 'add remove reset', refreshTransformedPosts);
|
||||||
this.on('change:displayType change:titleFormat change:titlePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:showDivider', refreshTransformedPosts);
|
this.on('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:showDivider', refreshTransformedPosts);
|
||||||
this.listenTo(this.get('readMoreButton'), 'change', refreshTransformedPosts);
|
this.listenTo(this.get('readMoreButton'), 'change', refreshTransformedPosts);
|
||||||
this.listenTo(this.get('divider'), 'change', refreshTransformedPosts);
|
this.listenTo(this.get('divider'), 'change', refreshTransformedPosts);
|
||||||
|
|
||||||
@ -394,9 +394,9 @@ define([
|
|||||||
"keyup .mailpoet_posts_show_amount": _.partial(this.changeField, "amount"),
|
"keyup .mailpoet_posts_show_amount": _.partial(this.changeField, "amount"),
|
||||||
"change .mailpoet_posts_content_type": _.partial(this.changeField, "contentType"),
|
"change .mailpoet_posts_content_type": _.partial(this.changeField, "contentType"),
|
||||||
"change .mailpoet_posts_include_or_exclude": _.partial(this.changeField, "inclusionType"),
|
"change .mailpoet_posts_include_or_exclude": _.partial(this.changeField, "inclusionType"),
|
||||||
"change .mailpoet_posts_title_position": _.partial(this.changeField, "titlePosition"),
|
|
||||||
"change .mailpoet_posts_title_alignment": _.partial(this.changeField, "titleAlignment"),
|
"change .mailpoet_posts_title_alignment": _.partial(this.changeField, "titleAlignment"),
|
||||||
"change .mailpoet_posts_image_full_width": _.partial(this.changeBoolField, "imageFullWidth"),
|
"change .mailpoet_posts_image_full_width": _.partial(this.changeBoolField, "imageFullWidth"),
|
||||||
|
"change .mailpoet_posts_featured_image_position": _.partial(this.changeField, "featuredImagePosition"),
|
||||||
"change .mailpoet_posts_show_author": _.partial(this.changeField, "showAuthor"),
|
"change .mailpoet_posts_show_author": _.partial(this.changeField, "showAuthor"),
|
||||||
"keyup .mailpoet_posts_author_preceded_by": _.partial(this.changeField, "authorPrecededBy"),
|
"keyup .mailpoet_posts_author_preceded_by": _.partial(this.changeField, "authorPrecededBy"),
|
||||||
"change .mailpoet_posts_show_categories": _.partial(this.changeField, "showCategories"),
|
"change .mailpoet_posts_show_categories": _.partial(this.changeField, "showCategories"),
|
||||||
@ -448,11 +448,11 @@ define([
|
|||||||
changeDisplayType: function(event) {
|
changeDisplayType: function(event) {
|
||||||
var value = jQuery(event.target).val();
|
var value = jQuery(event.target).val();
|
||||||
if (value == 'titleOnly') {
|
if (value == 'titleOnly') {
|
||||||
this.$('.mailpoet_posts_title_position_container').addClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_posts_title_as_list').removeClass('mailpoet_hidden');
|
this.$('.mailpoet_posts_title_as_list').removeClass('mailpoet_hidden');
|
||||||
|
this.$('.mailpoet_posts_image_full_width_option').addClass('mailpoet_hidden');
|
||||||
} else {
|
} else {
|
||||||
this.$('.mailpoet_posts_title_position_container').removeClass('mailpoet_hidden');
|
|
||||||
this.$('.mailpoet_posts_title_as_list').addClass('mailpoet_hidden');
|
this.$('.mailpoet_posts_title_as_list').addClass('mailpoet_hidden');
|
||||||
|
this.$('.mailpoet_posts_image_full_width_option').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 (this.model.get('titleFormat') === 'ul') {
|
||||||
@ -461,6 +461,13 @@ define([
|
|||||||
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);
|
||||||
},
|
},
|
||||||
changeTitleFormat: function(event) {
|
changeTitleFormat: function(event) {
|
||||||
|
@ -22,23 +22,35 @@ class PostTransformer {
|
|||||||
$content = $content_manager->filterContent($content);
|
$content = $content_manager->filterContent($content);
|
||||||
|
|
||||||
$structure_transformer = new StructureTransformer();
|
$structure_transformer = new StructureTransformer();
|
||||||
$structure = $structure_transformer->transform($content, $this->args['imageFullWidth'] === 'true');
|
$structure = $structure_transformer->transform($content, $this->args['imageFullWidth'] === true);
|
||||||
|
|
||||||
$structure = $this->appendFeaturedImage(
|
if ($this->args['featuredImagePosition'] === 'aboveTitle') {
|
||||||
$post,
|
$structure = $this->appendPostTitle($post, $structure);
|
||||||
$this->args['displayType'],
|
$structure = $this->appendFeaturedImage(
|
||||||
$this->args['imageFullWidth'] === 'true',
|
$post,
|
||||||
$structure
|
$this->args['displayType'],
|
||||||
);
|
$this->args['imageFullWidth'] === 'true',
|
||||||
$structure = $this->appendPostTitle($post, $structure);
|
$structure
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if ($this->args['featuredImagePosition'] === 'belowTitle') {
|
||||||
|
$structure = $this->appendFeaturedImage(
|
||||||
|
$post,
|
||||||
|
$this->args['displayType'],
|
||||||
|
$this->args['imageFullWidth'] === 'true',
|
||||||
|
$structure
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$structure = $this->appendPostTitle($post, $structure);
|
||||||
|
}
|
||||||
$structure = $this->appendReadMore($post->ID, $structure);
|
$structure = $this->appendReadMore($post->ID, $structure);
|
||||||
|
|
||||||
return $structure;
|
return $structure;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function appendFeaturedImage($post, $display_type, $image_full_width, $structure) {
|
private function appendFeaturedImage($post, $display_type, $image_full_width, $structure) {
|
||||||
if ($display_type === 'full') {
|
if ($display_type !== 'excerpt') {
|
||||||
// No featured images for full posts
|
// Append featured images only on excerpts
|
||||||
return $structure;
|
return $structure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,25 +108,12 @@ class PostTransformer {
|
|||||||
private function appendPostTitle($post, $structure) {
|
private function appendPostTitle($post, $structure) {
|
||||||
$title = $this->getPostTitle($post);
|
$title = $this->getPostTitle($post);
|
||||||
|
|
||||||
if ($this->args['titlePosition'] === 'inTextBlock') {
|
// Append title always at the top of the post structure
|
||||||
// Attach title to the first text block
|
// Reuse an existing text block if needed
|
||||||
$text_block_index = null;
|
|
||||||
foreach ($structure as $index => $block) {
|
|
||||||
if ($block['type'] === 'text') {
|
|
||||||
$text_block_index = $index;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($text_block_index === null) {
|
if (count($structure) > 0 && $structure[0]['type'] === 'text') {
|
||||||
$structure[] = array(
|
$structure[0]['text'] = $title . $structure[0]['text'];
|
||||||
'type' => 'text',
|
} else {
|
||||||
'text' => $title,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$structure[$text_block_index]['text'] = $title . $structure[$text_block_index]['text'];
|
|
||||||
}
|
|
||||||
} elseif ($this->args['titlePosition'] === 'aboveBlock') {
|
|
||||||
array_unshift(
|
array_unshift(
|
||||||
$structure,
|
$structure,
|
||||||
array(
|
array(
|
||||||
@ -133,14 +132,21 @@ class PostTransformer {
|
|||||||
$button['url'] = get_permalink($post_id);
|
$button['url'] = get_permalink($post_id);
|
||||||
$structure[] = $button;
|
$structure[] = $button;
|
||||||
} else {
|
} else {
|
||||||
$structure[] = array(
|
$totalBlocks = count($structure);
|
||||||
'type' => 'text',
|
$readMoreText = sprintf(
|
||||||
'text' => sprintf(
|
'<a href="%s">%s</a>',
|
||||||
'<a href="%s">%s</a>',
|
get_permalink($post_id),
|
||||||
get_permalink($post_id),
|
$this->args['readMoreText']
|
||||||
$this->args['readMoreText']
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($structure[$totalBlocks - 1]['type'] === 'text') {
|
||||||
|
$structure[$totalBlocks - 1]['text'] .= $readMoreText;
|
||||||
|
} else {
|
||||||
|
$structure[] = array(
|
||||||
|
'type' => 'text',
|
||||||
|
'text' => $readMoreText,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $structure;
|
return $structure;
|
||||||
|
@ -58,10 +58,6 @@ define([
|
|||||||
expect(model.get('titleFormat')).to.match(/^(h1|h2|h3|ul)$/);
|
expect(model.get('titleFormat')).to.match(/^(h1|h2|h3|ul)$/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has title position', function () {
|
|
||||||
expect(model.get('titlePosition')).to.match(/^(inTextBlock|aboveBlock)$/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('has title alignment', function () {
|
it('has title alignment', function () {
|
||||||
expect(model.get('titleAlignment')).to.match(/^(left|center|right)$/);
|
expect(model.get('titleAlignment')).to.match(/^(left|center|right)$/);
|
||||||
});
|
});
|
||||||
@ -74,6 +70,10 @@ define([
|
|||||||
expect(model.get('imageFullWidth')).to.be.a('boolean');
|
expect(model.get('imageFullWidth')).to.be.a('boolean');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('has featured image position', function () {
|
||||||
|
expect(model.get('featuredImagePosition')).to.match(/^(aboveTitle|belowTitle|none)$/);
|
||||||
|
});
|
||||||
|
|
||||||
it('has an option to display author', function () {
|
it('has an option to display author', function () {
|
||||||
expect(model.get('showAuthor')).to.match(/^(no|aboveText|belowText)$/);
|
expect(model.get('showAuthor')).to.match(/^(no|aboveText|belowText)$/);
|
||||||
});
|
});
|
||||||
@ -123,10 +123,10 @@ define([
|
|||||||
inclusionType: 'exclude', // 'include'|'exclude'
|
inclusionType: 'exclude', // 'include'|'exclude'
|
||||||
displayType: 'full', // 'excerpt'|'full'|'titleOnly'
|
displayType: 'full', // 'excerpt'|'full'|'titleOnly'
|
||||||
titleFormat: 'h3', // 'h1'|'h2'|'h3'|'ul'
|
titleFormat: 'h3', // 'h1'|'h2'|'h3'|'ul'
|
||||||
titlePosition: 'aboveBlock', // 'inTextBlock'|'aboveBlock',
|
|
||||||
titleAlignment: 'right', // 'left'|'center'|'right'
|
titleAlignment: 'right', // 'left'|'center'|'right'
|
||||||
titleIsLink: true, // false|true
|
titleIsLink: true, // false|true
|
||||||
imageFullWidth: false, // true|false
|
imageFullWidth: false, // true|false
|
||||||
|
featuredImagePosition: 'aboveTitle',
|
||||||
showAuthor: 'belowText', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'belowText', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: 'Custom config author preceded by',
|
authorPrecededBy: 'Custom config author preceded by',
|
||||||
showCategories: 'belowText', // 'no'|'aboveText'|'belowText'
|
showCategories: 'belowText', // 'no'|'aboveText'|'belowText'
|
||||||
@ -169,10 +169,10 @@ define([
|
|||||||
expect(model.get('inclusionType')).to.equal('exclude');
|
expect(model.get('inclusionType')).to.equal('exclude');
|
||||||
expect(model.get('displayType')).to.equal('full');
|
expect(model.get('displayType')).to.equal('full');
|
||||||
expect(model.get('titleFormat')).to.equal('h3');
|
expect(model.get('titleFormat')).to.equal('h3');
|
||||||
expect(model.get('titlePosition')).to.equal('aboveBlock');
|
|
||||||
expect(model.get('titleAlignment')).to.equal('right');
|
expect(model.get('titleAlignment')).to.equal('right');
|
||||||
expect(model.get('titleIsLink')).to.equal(true);
|
expect(model.get('titleIsLink')).to.equal(true);
|
||||||
expect(model.get('imageFullWidth')).to.equal(false);
|
expect(model.get('imageFullWidth')).to.equal(false);
|
||||||
|
expect(model.get('featuredImagePosition')).to.equal('aboveTitle');
|
||||||
expect(model.get('showAuthor')).to.equal('belowText');
|
expect(model.get('showAuthor')).to.equal('belowText');
|
||||||
expect(model.get('authorPrecededBy')).to.equal('Custom config author preceded by');
|
expect(model.get('authorPrecededBy')).to.equal('Custom config author preceded by');
|
||||||
expect(model.get('showCategories')).to.equal('belowText');
|
expect(model.get('showCategories')).to.equal('belowText');
|
||||||
@ -326,12 +326,6 @@ define([
|
|||||||
expect(model.get('titleFormat')).to.equal(newValue);
|
expect(model.get('titleFormat')).to.equal(newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('changes the model if title position changes', function () {
|
|
||||||
var newValue = 'aboveBlock';
|
|
||||||
view.$('.mailpoet_automated_latest_content_title_position').val(newValue).change();
|
|
||||||
expect(model.get('titlePosition')).to.equal(newValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('changes the model if title alignment changes', function () {
|
it('changes the model if title alignment changes', function () {
|
||||||
var newValue = 'right';
|
var newValue = 'right';
|
||||||
view.$('.mailpoet_automated_latest_content_title_alignment').val(newValue).change();
|
view.$('.mailpoet_automated_latest_content_title_alignment').val(newValue).change();
|
||||||
@ -350,6 +344,12 @@ define([
|
|||||||
expect(model.get('imageFullWidth')).to.equal(newValue);
|
expect(model.get('imageFullWidth')).to.equal(newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('changes the model if featured image position changes', function () {
|
||||||
|
var newValue = 'aboveTitle';
|
||||||
|
view.$('.mailpoet_automated_latest_content_featured_image_position').val(newValue).change();
|
||||||
|
expect(model.get('featuredImagePosition')).to.equal(newValue);
|
||||||
|
});
|
||||||
|
|
||||||
it('changes the model if show author changes', function () {
|
it('changes the model if show author changes', function () {
|
||||||
var newValue = 'belowText';
|
var newValue = 'belowText';
|
||||||
view.$('.mailpoet_automated_latest_content_show_author').val(newValue).change();
|
view.$('.mailpoet_automated_latest_content_show_author').val(newValue).change();
|
||||||
|
@ -62,10 +62,6 @@ define([
|
|||||||
expect(model.get('titleFormat')).to.match(/^(h1|h2|h3|ul)$/);
|
expect(model.get('titleFormat')).to.match(/^(h1|h2|h3|ul)$/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has title position', function () {
|
|
||||||
expect(model.get('titlePosition')).to.match(/^(inTextBlock|aboveBlock)$/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('has title alignment', function () {
|
it('has title alignment', function () {
|
||||||
expect(model.get('titleAlignment')).to.match(/^(left|center|right)$/);
|
expect(model.get('titleAlignment')).to.match(/^(left|center|right)$/);
|
||||||
});
|
});
|
||||||
@ -74,10 +70,14 @@ define([
|
|||||||
expect(model.get('titleIsLink')).to.be.a('boolean');
|
expect(model.get('titleIsLink')).to.be.a('boolean');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has image specific alignment', function () {
|
it('has image width', function () {
|
||||||
expect(model.get('imageFullWidth')).to.be.a('boolean');
|
expect(model.get('imageFullWidth')).to.be.a('boolean');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('has featured image position', function () {
|
||||||
|
expect(model.get('featuredImagePosition')).to.match(/^(belowTitle|aboveTitle|none)$/);
|
||||||
|
});
|
||||||
|
|
||||||
it('has an option to display author', function () {
|
it('has an option to display author', function () {
|
||||||
expect(model.get('showAuthor')).to.match(/^(no|aboveText|belowText)$/);
|
expect(model.get('showAuthor')).to.match(/^(no|aboveText|belowText)$/);
|
||||||
});
|
});
|
||||||
@ -127,11 +127,10 @@ define([
|
|||||||
inclusionType: 'exclude', // 'include'|'exclude'
|
inclusionType: 'exclude', // 'include'|'exclude'
|
||||||
displayType: 'full', // 'excerpt'|'full'|'titleOnly'
|
displayType: 'full', // 'excerpt'|'full'|'titleOnly'
|
||||||
titleFormat: 'h3', // 'h1'|'h2'|'h3'|'ul'
|
titleFormat: 'h3', // 'h1'|'h2'|'h3'|'ul'
|
||||||
titlePosition: 'aboveBlock', // 'inTextBlock'|'aboveBlock',
|
|
||||||
titleAlignment: 'right', // 'left'|'center'|'right'
|
titleAlignment: 'right', // 'left'|'center'|'right'
|
||||||
titleIsLink: true, // false|true
|
titleIsLink: true, // false|true
|
||||||
imageFullWidth: false, // true|false
|
imageFullWidth: false, // true|false
|
||||||
//imageAlignment: 'right', // 'centerFull'|'centerPadded'|'left'|'right'|'alternate'|'none'
|
featuredImagePosition: 'aboveTitle',
|
||||||
showAuthor: 'belowText', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'belowText', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: 'Custom config author preceded by',
|
authorPrecededBy: 'Custom config author preceded by',
|
||||||
showCategories: 'belowText', // 'no'|'aboveText'|'belowText'
|
showCategories: 'belowText', // 'no'|'aboveText'|'belowText'
|
||||||
@ -174,10 +173,10 @@ define([
|
|||||||
expect(model.get('inclusionType')).to.equal('exclude');
|
expect(model.get('inclusionType')).to.equal('exclude');
|
||||||
expect(model.get('displayType')).to.equal('full');
|
expect(model.get('displayType')).to.equal('full');
|
||||||
expect(model.get('titleFormat')).to.equal('h3');
|
expect(model.get('titleFormat')).to.equal('h3');
|
||||||
expect(model.get('titlePosition')).to.equal('aboveBlock');
|
|
||||||
expect(model.get('titleAlignment')).to.equal('right');
|
expect(model.get('titleAlignment')).to.equal('right');
|
||||||
expect(model.get('titleIsLink')).to.equal(true);
|
expect(model.get('titleIsLink')).to.equal(true);
|
||||||
expect(model.get('imageFullWidth')).to.equal(false);
|
expect(model.get('imageFullWidth')).to.equal(false);
|
||||||
|
expect(model.get('featuredImagePosition')).to.equal('aboveTitle');
|
||||||
expect(model.get('showAuthor')).to.equal('belowText');
|
expect(model.get('showAuthor')).to.equal('belowText');
|
||||||
expect(model.get('authorPrecededBy')).to.equal('Custom config author preceded by');
|
expect(model.get('authorPrecededBy')).to.equal('Custom config author preceded by');
|
||||||
expect(model.get('showCategories')).to.equal('belowText');
|
expect(model.get('showCategories')).to.equal('belowText');
|
||||||
@ -299,12 +298,6 @@ define([
|
|||||||
expect(model.get('titleFormat')).to.equal(newValue);
|
expect(model.get('titleFormat')).to.equal(newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('changes the model if title position changes', function () {
|
|
||||||
var newValue = 'aboveBlock';
|
|
||||||
view.$('.mailpoet_posts_title_position').val(newValue).change();
|
|
||||||
expect(model.get('titlePosition')).to.equal(newValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('changes the model if title alignment changes', function () {
|
it('changes the model if title alignment changes', function () {
|
||||||
var newValue = 'right';
|
var newValue = 'right';
|
||||||
view.$('.mailpoet_posts_title_alignment').val(newValue).change();
|
view.$('.mailpoet_posts_title_alignment').val(newValue).change();
|
||||||
@ -323,6 +316,12 @@ define([
|
|||||||
expect(model.get('imageFullWidth')).to.equal(newValue);
|
expect(model.get('imageFullWidth')).to.equal(newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('changes the model if featured image position changes', function () {
|
||||||
|
var newValue = 'aboveTitle';
|
||||||
|
view.$('.mailpoet_posts_featured_image_position').val(newValue).change();
|
||||||
|
expect(model.get('featuredImagePosition')).to.equal(newValue);
|
||||||
|
});
|
||||||
|
|
||||||
it('changes the model if show author changes', function () {
|
it('changes the model if show author changes', function () {
|
||||||
var newValue = 'belowText';
|
var newValue = 'belowText';
|
||||||
view.$('.mailpoet_posts_show_author').val(newValue).change();
|
view.$('.mailpoet_posts_show_author').val(newValue).change();
|
||||||
|
@ -1543,10 +1543,10 @@
|
|||||||
inclusionType: 'include', // 'include'|'exclude'
|
inclusionType: 'include', // 'include'|'exclude'
|
||||||
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
||||||
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
||||||
titlePosition: 'inTextBlock', // 'inTextBlock'|'aboveBlock',
|
|
||||||
titleAlignment: 'left', // 'left'|'center'|'right'
|
titleAlignment: 'left', // 'left'|'center'|'right'
|
||||||
titleIsLink: false, // false|true
|
titleIsLink: false, // false|true
|
||||||
imagePadded: true, // true|false
|
imagePadded: true, // true|false
|
||||||
|
featuredImagePosition: 'belowTitle', // 'belowTitle'|'aboveTitle'|'none'
|
||||||
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: '<%= __('Author:') %>',
|
authorPrecededBy: '<%= __('Author:') %>',
|
||||||
showCategories: 'no', // 'no'|'aboveText'|'belowText'
|
showCategories: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
@ -1663,10 +1663,10 @@
|
|||||||
inclusionType: 'include', // 'include'|'exclude'
|
inclusionType: 'include', // 'include'|'exclude'
|
||||||
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
||||||
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
||||||
titlePosition: 'inTextBlock', // 'inTextBlock'|'aboveBlock',
|
|
||||||
titleAlignment: 'left', // 'left'|'center'|'right'
|
titleAlignment: 'left', // 'left'|'center'|'right'
|
||||||
titleIsLink: false, // false|true
|
titleIsLink: false, // false|true
|
||||||
imagePadded: true, // true|false
|
imagePadded: true, // true|false
|
||||||
|
featuredImagePosition: 'belowTitle', // 'belowTitle'|'aboveTitle'|'none'
|
||||||
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: '<%= __('Author:') %>',
|
authorPrecededBy: '<%= __('Author:') %>',
|
||||||
showCategories: 'no', // 'no'|'aboveText'|'belowText'
|
showCategories: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
|
@ -922,10 +922,10 @@
|
|||||||
inclusionType: 'include', // 'include'|'exclude'
|
inclusionType: 'include', // 'include'|'exclude'
|
||||||
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
||||||
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
||||||
titlePosition: 'inTextBlock', // 'inTextBlock'|'aboveBlock',
|
|
||||||
titleAlignment: 'left', // 'left'|'center'|'right'
|
titleAlignment: 'left', // 'left'|'center'|'right'
|
||||||
titleIsLink: false, // false|true
|
titleIsLink: false, // false|true
|
||||||
imageFullWidth: false, // true|false
|
imageFullWidth: false, // true|false
|
||||||
|
featuredImagePosition: 'belowTitle', // 'belowTitle'|'aboveTitle'|'none',
|
||||||
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: '<%= __('Author:') %>',
|
authorPrecededBy: '<%= __('Author:') %>',
|
||||||
showCategories: 'no', // 'no'|'aboveText'|'belowText'
|
showCategories: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
@ -1046,10 +1046,10 @@
|
|||||||
inclusionType: 'include', // 'include'|'exclude'
|
inclusionType: 'include', // 'include'|'exclude'
|
||||||
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
|
||||||
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
|
||||||
titlePosition: 'inTextBlock', // 'inTextBlock'|'aboveBlock',
|
|
||||||
titleAlignment: 'left', // 'left'|'center'|'right'
|
titleAlignment: 'left', // 'left'|'center'|'right'
|
||||||
titleIsLink: false, // false|true
|
titleIsLink: false, // false|true
|
||||||
imageFullWidth: false, // true|false
|
imageFullWidth: false, // true|false
|
||||||
|
featuredImagePosition: 'belowTitle', // 'belowTitle'|'aboveTitle'|'none',
|
||||||
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: '<%= __('Author:') %>',
|
authorPrecededBy: '<%= __('Author:') %>',
|
||||||
showCategories: 'no', // 'no'|'aboveText'|'belowText'
|
showCategories: 'no', // 'no'|'aboveText'|'belowText'
|
||||||
|
@ -95,22 +95,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mailpoet_form_field mailpoet_automated_latest_content_title_position_container {{#ifCond model.displayType '===' 'titleOnly'}}mailpoet_hidden{{/ifCond}}">
|
|
||||||
<div class="mailpoet_form_field_title"><%= __('Title Position') %></div>
|
|
||||||
<div class="mailpoet_form_field_radio_option">
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="mailpoet_automated_latest_content_title_position" class="mailpoet_automated_latest_content_title_position" value="inTextBlock" {{#ifCond model.titlePosition '==' 'inTextBlock' }}CHECKED{{/ifCond}}/>
|
|
||||||
<%= __('In text block') %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="mailpoet_form_field_radio_option">
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="mailpoet_automated_latest_content_title_position" class="mailpoet_automated_latest_content_title_position" value="aboveBlock" {{#ifCond model.titlePosition '==' 'aboveBlock' }}CHECKED{{/ifCond}}/>
|
|
||||||
<%= __('Above block') %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mailpoet_form_field">
|
<div class="mailpoet_form_field">
|
||||||
<div class="mailpoet_form_field_title"><%= __('Title Alignment') %></div>
|
<div class="mailpoet_form_field_title"><%= __('Title Alignment') %></div>
|
||||||
<div class="mailpoet_form_field_radio_option">
|
<div class="mailpoet_form_field_radio_option">
|
||||||
@ -151,8 +135,30 @@
|
|||||||
|
|
||||||
<hr class="mailpoet_separator" />
|
<hr class="mailpoet_separator" />
|
||||||
|
|
||||||
|
<div class="mailpoet_form_field mailpoet_automated_latest_content_featured_image_position_container {{#ifCond model.displayType '!==' 'excerpt'}}mailpoet_hidden{{/ifCond}}">
|
||||||
|
<div class="mailpoet_form_field_title"><%= __('Featured image position') %></div>
|
||||||
|
<div class="mailpoet_form_field_radio_option">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="mailpoet_automated_latest_content_featured_image_position" class="mailpoet_automated_latest_content_featured_image_position" value="belowTitle" {{#ifCond model.featuredImagePosition '==' 'belowTitle' }}CHECKED{{/ifCond}}/>
|
||||||
|
<%= __('Below title') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="mailpoet_form_field_radio_option">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="mailpoet_automated_latest_content_featured_image_position" class="mailpoet_automated_latest_content_featured_image_position" value="aboveTitle" {{#ifCond model.featuredImagePosition '==' 'aboveTitle' }}CHECKED{{/ifCond}}/>
|
||||||
|
<%= __('Above title') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="mailpoet_form_field_radio_option">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="mailpoet_automated_latest_content_featured_image_position" class="mailpoet_automated_latest_content_featured_image_position" value="none" {{#ifCond model.featuredImagePosition '==' 'none' }}CHECKED{{/ifCond}}/>
|
||||||
|
<%= __('None') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mailpoet_automated_latest_content_non_title_list_options {{#ifCond model.displayType '==' 'titleOnly'}}{{#ifCond model.titleFormat '==' 'ul'}}mailpoet_hidden{{/ifCond}}{{/ifCond}}">
|
<div class="mailpoet_automated_latest_content_non_title_list_options {{#ifCond model.displayType '==' 'titleOnly'}}{{#ifCond model.titleFormat '==' 'ul'}}mailpoet_hidden{{/ifCond}}{{/ifCond}}">
|
||||||
<div class="mailpoet_form_field">
|
<div class="mailpoet_form_field mailpoet_automated_latest_content_image_full_width_option {{#ifCond model.displayType '==' 'titleOnly'}}mailpoet_hidden{{/ifCond}}">
|
||||||
<div class="mailpoet_form_field_title"><%= __('Image width') %></div>
|
<div class="mailpoet_form_field_title"><%= __('Image width') %></div>
|
||||||
<div class="mailpoet_form_field_radio_option">
|
<div class="mailpoet_form_field_radio_option">
|
||||||
<label>
|
<label>
|
||||||
|
@ -49,22 +49,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mailpoet_form_field mailpoet_posts_title_position_container {{#ifCond model.displayType '===' 'titleOnly'}}mailpoet_hidden{{/ifCond}}">
|
|
||||||
<div class="mailpoet_form_field_title"><%= __('Title Position') %></div>
|
|
||||||
<div class="mailpoet_form_field_radio_option">
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="mailpoet_posts_title_position" class="mailpoet_posts_title_position" value="inTextBlock" {{#ifCond model.titlePosition '==' 'inTextBlock' }}CHECKED{{/ifCond}}/>
|
|
||||||
<%= __('In text block') %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="mailpoet_form_field_radio_option">
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="mailpoet_posts_title_position" class="mailpoet_posts_title_position" value="aboveBlock" {{#ifCond model.titlePosition '==' 'aboveBlock' }}CHECKED{{/ifCond}}/>
|
|
||||||
<%= __('Above block') %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mailpoet_form_field">
|
<div class="mailpoet_form_field">
|
||||||
<div class="mailpoet_form_field_title"><%= __('Title Alignment') %></div>
|
<div class="mailpoet_form_field_title"><%= __('Title Alignment') %></div>
|
||||||
<div class="mailpoet_form_field_radio_option">
|
<div class="mailpoet_form_field_radio_option">
|
||||||
@ -106,7 +90,30 @@
|
|||||||
<hr class="mailpoet_separator" />
|
<hr class="mailpoet_separator" />
|
||||||
|
|
||||||
<div class="mailpoet_posts_non_title_list_options {{#ifCond model.displayType '==' 'titleOnly'}}{{#ifCond model.titleFormat '==' 'ul'}}mailpoet_hidden{{/ifCond}}{{/ifCond}}">
|
<div class="mailpoet_posts_non_title_list_options {{#ifCond model.displayType '==' 'titleOnly'}}{{#ifCond model.titleFormat '==' 'ul'}}mailpoet_hidden{{/ifCond}}{{/ifCond}}">
|
||||||
<div class="mailpoet_form_field">
|
|
||||||
|
<div class="mailpoet_form_field mailpoet_posts_featured_image_position_container {{#ifCond model.displayType '!==' 'excerpt'}}mailpoet_hidden{{/ifCond}}">
|
||||||
|
<div class="mailpoet_form_field_title"><%= __('Featured image position') %></div>
|
||||||
|
<div class="mailpoet_form_field_radio_option">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="mailpoet_posts_featured_image_position" class="mailpoet_posts_featured_image_position" value="belowTitle" {{#ifCond model.featuredImagePosition '==' 'belowTitle' }}CHECKED{{/ifCond}}/>
|
||||||
|
<%= __('Below title') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="mailpoet_form_field_radio_option">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="mailpoet_posts_featured_image_position" class="mailpoet_posts_featured_image_position" value="aboveTitle" {{#ifCond model.featuredImagePosition '==' 'aboveTitle' }}CHECKED{{/ifCond}}/>
|
||||||
|
<%= __('Above block') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="mailpoet_form_field_radio_option">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="mailpoet_posts_featured_image_position" class="mailpoet_posts_featured_image_position" value="none" {{#ifCond model.featuredImagePosition '==' 'none' }}CHECKED{{/ifCond}}/>
|
||||||
|
<%= __('None') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mailpoet_form_field mailpoet_posts_image_full_width_option {{#ifCond model.displayType '==' 'titleOnly'}}mailpoet_hidden{{/ifCond}}">
|
||||||
<div class="mailpoet_form_field_title"><%= __('Image width') %></div>
|
<div class="mailpoet_form_field_title"><%= __('Image width') %></div>
|
||||||
<div class="mailpoet_form_field_radio_option">
|
<div class="mailpoet_form_field_radio_option">
|
||||||
<label>
|
<label>
|
||||||
|
Reference in New Issue
Block a user