Remember currently showed settings model ID

[MAILPOET-1974]
This commit is contained in:
Ján Mikláš
2019-05-02 13:29:03 +02:00
committed by M. Shull
parent 4817347293
commit 970e835ddc
2 changed files with 7 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ var EditorApplication = Marionette.Application.extend({
onStart: function onStart() {
this._appView = new AppView();
this.showView(this._appView);
this.listenTo(this.getChannel(), 'settingsShowed', this.setShowedSettingsId);
},
getChannel: function getChannel(channel) {
@@ -29,6 +30,10 @@ var EditorApplication = Marionette.Application.extend({
}
return Radio.channel(channel);
},
setShowedSettingsId: function setShowedSettingsId(id) {
this.showedSettingsId = id;
},
});
var app = new EditorApplication();

View File

@@ -225,6 +225,7 @@ Module.BlockToolsView = AugmentedView.extend({
},
changeSettings: function changeSettings(options) {
var ViewType = this.getSettingsView();
App.getChannel().trigger('settingsShowed', this.model.cid);
(new ViewType(_.extend({ model: this.model }, options || {}))).render();
},
showDeletionConfirmation: function showDeletionConfirmation() {
@@ -313,6 +314,7 @@ Module.BlockSettingsView = Marionette.View.extend({
onBeforeDestroy: function onBeforeDestroy() {
MailPoet.Modal.close();
this.model.trigger('stopEditing');
App.getChannel().trigger('settingsShowed', null);
},
});