Fix rendering of Posts settings

This commit is contained in:
Tautvidas Sipavičius
2015-10-07 13:19:19 +03:00
parent 8a5bf93db2
commit 3cfe9a9acc
3 changed files with 5 additions and 19 deletions

View File

@@ -61,7 +61,7 @@ define([
};
},
initialize: function() {
base.BlockModel.prototype.initialize.apply(this);
base.BlockView.prototype.initialize.apply(this, arguments);
this.fetchPosts();
this.on('change:amount change:contentType change:terms change:inclusionType change:displayType change:titleFormat change:titlePosition change:titleAlignment change:titleIsLink change:imagePadded 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);

View File

@@ -189,7 +189,6 @@ define([
});
},
close: function(event) {
MailPoet.Modal.cancel();
this.destroy();
},
changeField: function(field, event) {
@@ -211,6 +210,9 @@ define([
}
this.model.set(field, value);
},
onBeforeDestroy: function() {
MailPoet.Modal.close();
},
});
Module.WidgetView = Marionette.ItemView.extend({

View File

@@ -132,8 +132,8 @@ define([
modelEvents: {},
onDragSubstituteBy: function() { return Module.PostsWidgetView; },
initialize: function() {
base.BlockView.prototype.initialize.apply(this, arguments);
this.toolsView = new Module.PostsBlockToolsView({ model: this.model });
this.on('showSettings', this.showSettings);
this.model.reply('blockView', this.notifyAboutSelf, this);
},
onRender: function() {
@@ -142,9 +142,6 @@ define([
}
this.trigger('showSettings');
},
showSettings: function(options) {
this.toolsView.triggerMethod('showSettings', options);
},
notifyAboutSelf: function() {
return this;
},
@@ -155,19 +152,6 @@ define([
Module.PostsBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.PostsBlockSettingsView; },
initialize: function() {
base.BlockToolsView.prototype.initialize.apply(this, arguments);
this.on('showSettings', this.changeSettings);
this.settingsView = new Module.PostsBlockSettingsView({ model: this.model });
},
changeSettings: function() {
this.settingsView.render();
},
onBeforeDestroy: function() {
this.settingsView.destroy();
this.off('showSettings');
MailPoet.Modal.close();
},
});
Module.PostsBlockSettingsView = base.BlockSettingsView.extend({