Fix rendering of Posts settings
This commit is contained in:
@@ -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);
|
||||
|
@@ -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({
|
||||
|
@@ -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({
|
||||
|
Reference in New Issue
Block a user