diff --git a/assets/js/src/newsletter_editor/blocks/posts.js b/assets/js/src/newsletter_editor/blocks/posts.js index aedc96d2cb..3062e803d1 100644 --- a/assets/js/src/newsletter_editor/blocks/posts.js +++ b/assets/js/src/newsletter_editor/blocks/posts.js @@ -216,8 +216,8 @@ define([ var that = this, blockView = this.model.request('blockView'); - this.selectionRegion.show(this.selectionView); - this.displayOptionsRegion.show(this.displayOptionsView); + this.showChildView('selectionRegion', this.selectionView); + this.showChildView('displayOptionsRegion', this.displayOptionsView); MailPoet.Modal.panel({ element: this.$el, @@ -230,6 +230,9 @@ define([ }, }); + // Inform child views that they have been attached to document + this.selectionView.triggerMethod('attach'); + this.displayOptionsView.triggerMethod('attach'); }, switchToDisplayOptions: function() { // Switch content view @@ -279,10 +282,14 @@ define([ Marionette.CompositeView.apply(this, arguments); }, onRender: function() { + // Dynamically update available post types + CommunicationComponent.getPostTypes().done(_.bind(this._updateContentTypes, this)); + }, + onAttach: function() { var that = this; // Dynamically update available post types - CommunicationComponent.getPostTypes().done(_.bind(this._updateContentTypes, this)); + //CommunicationComponent.getPostTypes().done(_.bind(this._updateContentTypes, this)); this.$('.mailpoet_posts_categories_and_tags').select2({ multiple: true, diff --git a/tests/javascript/mochaTestHelper.js b/tests/javascript/mochaTestHelper.js index 187f8a67b4..47a2f7bf38 100644 --- a/tests/javascript/mochaTestHelper.js +++ b/tests/javascript/mochaTestHelper.js @@ -42,6 +42,7 @@ global.interact = function () { on: global.interact, dropzone: global.interact, preventDefault: global.interact, + actionChecker: global.interact, }; };