diff --git a/assets/js/src/newsletter_editor/blocks/automatedLatestContent.js b/assets/js/src/newsletter_editor/blocks/automatedLatestContent.js index 888643607d..d89df90960 100644 --- a/assets/js/src/newsletter_editor/blocks/automatedLatestContent.js +++ b/assets/js/src/newsletter_editor/blocks/automatedLatestContent.js @@ -70,8 +70,8 @@ define([ fetchPosts: function() { var that = this; CommunicationComponent.getTransformedPosts(this.toJSON()).done(function(content) { - console.log('ALC fetched', arguments); that.get('_container').get('blocks').reset(content, {parse: true}); + that.trigger('postsChanged'); }).fail(function(error) { console.log('ALC fetchPosts error', arguments); }); @@ -100,6 +100,11 @@ define([ toolsRegion: '.mailpoet_tools', postsRegion: '.mailpoet_automated_latest_content_block_posts', }, + modelEvents: _.extend( + _.omit(base.BlockView.prototype.modelEvents, 'change'), + { + 'postsChanged': 'render', + }), events: _.extend(base.BlockView.prototype.events, { 'click .mailpoet_automated_latest_content_block_overlay': 'showSettings', }), diff --git a/assets/js/src/newsletter_editor/blocks/posts.js b/assets/js/src/newsletter_editor/blocks/posts.js index 20e7379e1a..756f8263eb 100644 --- a/assets/js/src/newsletter_editor/blocks/posts.js +++ b/assets/js/src/newsletter_editor/blocks/posts.js @@ -97,7 +97,6 @@ define([ fetchAvailablePosts: function() { var that = this; CommunicationComponent.getPosts(this.toJSON()).done(function(posts) { - console.log('Posts fetched', arguments); that.get('_availablePosts').reset(posts); that.get('_selectedPosts').reset(); // Empty out the collection that.trigger('change:_availablePosts'); @@ -117,7 +116,6 @@ define([ } CommunicationComponent.getTransformedPosts(data).done(function(posts) { - console.log('Transformed posts fetched', arguments); that.get('_transformedPosts').get('blocks').reset(posts, {parse: true}); }).fail(function() { console.log('Posts _refreshTransformedPosts error', arguments); @@ -134,7 +132,6 @@ define([ if (data.posts.length === 0) return; CommunicationComponent.getTransformedPosts(data).done(function(posts) { - console.log('Available posts fetched', arguments); collection.add(posts, { at: index }); }).fail(function() { console.log('Posts fetchPosts error', arguments);