Fix double animations when ALC block changes, remove console.log lines
This commit is contained in:
@@ -70,8 +70,8 @@ define([
|
|||||||
fetchPosts: function() {
|
fetchPosts: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
CommunicationComponent.getTransformedPosts(this.toJSON()).done(function(content) {
|
CommunicationComponent.getTransformedPosts(this.toJSON()).done(function(content) {
|
||||||
console.log('ALC fetched', arguments);
|
|
||||||
that.get('_container').get('blocks').reset(content, {parse: true});
|
that.get('_container').get('blocks').reset(content, {parse: true});
|
||||||
|
that.trigger('postsChanged');
|
||||||
}).fail(function(error) {
|
}).fail(function(error) {
|
||||||
console.log('ALC fetchPosts error', arguments);
|
console.log('ALC fetchPosts error', arguments);
|
||||||
});
|
});
|
||||||
@@ -100,6 +100,11 @@ define([
|
|||||||
toolsRegion: '.mailpoet_tools',
|
toolsRegion: '.mailpoet_tools',
|
||||||
postsRegion: '.mailpoet_automated_latest_content_block_posts',
|
postsRegion: '.mailpoet_automated_latest_content_block_posts',
|
||||||
},
|
},
|
||||||
|
modelEvents: _.extend(
|
||||||
|
_.omit(base.BlockView.prototype.modelEvents, 'change'),
|
||||||
|
{
|
||||||
|
'postsChanged': 'render',
|
||||||
|
}),
|
||||||
events: _.extend(base.BlockView.prototype.events, {
|
events: _.extend(base.BlockView.prototype.events, {
|
||||||
'click .mailpoet_automated_latest_content_block_overlay': 'showSettings',
|
'click .mailpoet_automated_latest_content_block_overlay': 'showSettings',
|
||||||
}),
|
}),
|
||||||
|
@@ -97,7 +97,6 @@ define([
|
|||||||
fetchAvailablePosts: function() {
|
fetchAvailablePosts: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
CommunicationComponent.getPosts(this.toJSON()).done(function(posts) {
|
CommunicationComponent.getPosts(this.toJSON()).done(function(posts) {
|
||||||
console.log('Posts fetched', arguments);
|
|
||||||
that.get('_availablePosts').reset(posts);
|
that.get('_availablePosts').reset(posts);
|
||||||
that.get('_selectedPosts').reset(); // Empty out the collection
|
that.get('_selectedPosts').reset(); // Empty out the collection
|
||||||
that.trigger('change:_availablePosts');
|
that.trigger('change:_availablePosts');
|
||||||
@@ -117,7 +116,6 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
||||||
console.log('Transformed posts fetched', arguments);
|
|
||||||
that.get('_transformedPosts').get('blocks').reset(posts, {parse: true});
|
that.get('_transformedPosts').get('blocks').reset(posts, {parse: true});
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
console.log('Posts _refreshTransformedPosts error', arguments);
|
console.log('Posts _refreshTransformedPosts error', arguments);
|
||||||
@@ -134,7 +132,6 @@ define([
|
|||||||
if (data.posts.length === 0) return;
|
if (data.posts.length === 0) return;
|
||||||
|
|
||||||
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
||||||
console.log('Available posts fetched', arguments);
|
|
||||||
collection.add(posts, { at: index });
|
collection.add(posts, { at: index });
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
console.log('Posts fetchPosts error', arguments);
|
console.log('Posts fetchPosts error', arguments);
|
||||||
|
Reference in New Issue
Block a user