diff --git a/assets/css/src/newsletter_editor/contentBlocks/divider.styl b/assets/css/src/newsletter_editor/contentBlocks/divider.styl index 138a54b842..90dbd66d38 100644 --- a/assets/css/src/newsletter_editor/contentBlocks/divider.styl +++ b/assets/css/src/newsletter_editor/contentBlocks/divider.styl @@ -19,6 +19,10 @@ $divider-hover-border-color = $primary-active-color width: 100% border: 1px solid transparent +.mailpoet_active_divider_style + border: 1px solid $active-divider-border-color + background: $active-divider-background-color + .mailpoet_field_divider_style:hover border: 1px solid $divider-hover-border-color diff --git a/assets/js/src/newsletter_editor/blocks/base.js b/assets/js/src/newsletter_editor/blocks/base.js index 9e8cf7151e..18ad54f543 100644 --- a/assets/js/src/newsletter_editor/blocks/base.js +++ b/assets/js/src/newsletter_editor/blocks/base.js @@ -214,6 +214,7 @@ define([ this.model.set(field, value); }, onBeforeDestroy: function() { + console.log('Calling close'); MailPoet.Modal.close(); }, }); diff --git a/assets/js/src/newsletter_editor/blocks/posts.js b/assets/js/src/newsletter_editor/blocks/posts.js index 4ea6edf91f..0c363fa7eb 100644 --- a/assets/js/src/newsletter_editor/blocks/posts.js +++ b/assets/js/src/newsletter_editor/blocks/posts.js @@ -241,6 +241,7 @@ define([ insertPosts: function() { this.model.trigger('insertSelectedPosts'); this.model.destroy(); + this.close(); }, }); @@ -332,11 +333,6 @@ define([ }, }).trigger( 'change' ); }, - onBeforeDestroy: function() { - base.BlockSettingsView.prototype.onBeforeDestroy.apply(this, arguments); - // Force close select2 if it hasn't closed yet - this.$('.mailpoet_posts_categories_and_tags').select2('close'); - }, changeField: function(field, event) { this.model.set(field, jQuery(event.target).val()); }, diff --git a/assets/js/src/newsletter_editor/components/wordpress.js b/assets/js/src/newsletter_editor/components/wordpress.js index 6b3c43da0c..6daf0672a8 100644 --- a/assets/js/src/newsletter_editor/components/wordpress.js +++ b/assets/js/src/newsletter_editor/components/wordpress.js @@ -56,7 +56,7 @@ define([ }; Module.getTransformedPosts = function(options) { - return Module._cachedQuery({ + return Module._query({ action: 'getTransformedPosts', options: options, }); diff --git a/lib/Newsletter/Editor/MetaInformationManager.php b/lib/Newsletter/Editor/MetaInformationManager.php index 9a3bb71bc2..8b1f842e4e 100644 --- a/lib/Newsletter/Editor/MetaInformationManager.php +++ b/lib/Newsletter/Editor/MetaInformationManager.php @@ -50,9 +50,11 @@ class MetaInformationManager { // check if the user specified a label to be displayed before the author's name if(strlen($preceded_by) > 0) { $content = stripslashes($preceded_by) . ' '; + } else { + $content = ''; } - return join(', ', $categories); + return $content . join(', ', $categories); } else { return ''; } diff --git a/lib/Newsletter/Editor/PostTransformer.php b/lib/Newsletter/Editor/PostTransformer.php index 9b87082740..e9c56db245 100644 --- a/lib/Newsletter/Editor/PostTransformer.php +++ b/lib/Newsletter/Editor/PostTransformer.php @@ -24,14 +24,24 @@ class PostTransformer { $structure_transformer = new StructureTransformer(); $structure = $structure_transformer->transform($content, (bool)$this->args['imagePadded']); - $structure = $this->appendFeaturedImage($post, (bool)$this->args['imagePadded'], $structure); + $structure = $this->appendFeaturedImage( + $post, + $this->args['displayType'], + $this->args['imagePadded'] === 'true', + $structure + ); $structure = $this->appendPostTitle($post, $structure); $structure = $this->appendReadMore($post->ID, $structure); return $structure; } - private function appendFeaturedImage($post, $image_padded, $structure) { + private function appendFeaturedImage($post, $display_type, $image_padded, $structure) { + if ($display_type === 'full') { + // No featured images for full posts + return $structure; + } + $featured_image = $this->getFeaturedImage( $post->ID, $post->post_title, @@ -68,7 +78,7 @@ class PostTransformer { return array( 'type' => 'image', - 'link' => '', + 'link' => get_permalink($post_id), 'src' => $image_info[0], 'alt' => $alt_text, 'padded' => $image_padded, @@ -84,6 +94,8 @@ class PostTransformer { } private function appendPostTitle($post, $structure) { + $title = $this->getPostTitle($post); + if ($this->args['titlePosition'] === 'inTextBlock') { // Attach title to the first text block $text_block_index = null; @@ -94,7 +106,6 @@ class PostTransformer { } } - $title = $this->getPostTitle($post); if ($text_block_index === null) { $structure[] = array( 'type' => 'text', @@ -103,6 +114,14 @@ class PostTransformer { } else { $structure[$text_block_index]['text'] = $title . $structure[$text_block_index]['text']; } + } elseif ($this->args['titlePosition'] === 'aboveBlock') { + array_unshift( + $structure, + array( + 'type' => 'text', + 'text' => $title, + ) + ); } return $structure; @@ -113,6 +132,15 @@ class PostTransformer { $button = $this->args['readMoreButton']; $button['url'] = get_permalink($post_id); $structure[] = $button; + } else { + $structure[] = array( + 'type' => 'text', + 'text' => sprintf( + '%s', + get_permalink($post_id), + $this->args['readMoreText'] + ), + ); } return $structure; diff --git a/views/newsletter/templates/blocks/automatedLatestContent/settings.hbs b/views/newsletter/templates/blocks/automatedLatestContent/settings.hbs index c4d4784b68..c9af62e9cd 100644 --- a/views/newsletter/templates/blocks/automatedLatestContent/settings.hbs +++ b/views/newsletter/templates/blocks/automatedLatestContent/settings.hbs @@ -215,7 +215,7 @@ <%= __('Below text') %> -
<%= __('Categories:') %>
+
<%= __('Preceded by:') %>
diff --git a/views/newsletter/templates/blocks/button/settings.hbs b/views/newsletter/templates/blocks/button/settings.hbs index 21b3e52851..1163de17d9 100644 --- a/views/newsletter/templates/blocks/button/settings.hbs +++ b/views/newsletter/templates/blocks/button/settings.hbs @@ -20,6 +20,7 @@ {{/ifCond}}
+
<%= __('Alignment') %>
-
<%= __('Categories:') %>
+
<%= __('Preceded by:') %>
diff --git a/views/newsletter/templates/blocks/posts/settingsSelection.hbs b/views/newsletter/templates/blocks/posts/settingsSelection.hbs index a582e4542e..7b295586ff 100644 --- a/views/newsletter/templates/blocks/posts/settingsSelection.hbs +++ b/views/newsletter/templates/blocks/posts/settingsSelection.hbs @@ -13,6 +13,9 @@
+
+
<%= __('Categories & tags:') %>
+