propagate remove event for stored main view
This commit is contained in:
+9
-1
@@ -999,8 +999,16 @@ var Bull = Bull || {};
|
||||
|
||||
this.$el = $(el).eq(0);
|
||||
this.el = this.$el[0];
|
||||
}
|
||||
},
|
||||
|
||||
propagateEvent: function () {
|
||||
this.trigger.apply(this, arguments);
|
||||
|
||||
for (var key in this.nestedViews) {
|
||||
var view = this.nestedViews[key];
|
||||
view.propagateEvent.apply(view, arguments);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
}).call(this, Bull, Backbone, _);
|
||||
|
||||
@@ -157,7 +157,13 @@ define('controller', [], function () {
|
||||
|
||||
storeMainView: function (key, view) {
|
||||
this.set('storedMainView-' + key, view);
|
||||
view.once('remove', function () {
|
||||
|
||||
this.listenTo(view, 'remove', function (o) {
|
||||
o = o || {};
|
||||
if (o.ignoreCleaning) return;
|
||||
|
||||
this.stopListening(view, 'remove');
|
||||
|
||||
this.clearStoredMainView(key);
|
||||
}, this);
|
||||
},
|
||||
@@ -278,6 +284,10 @@ define('controller', [], function () {
|
||||
if (master.currentViewKey) {
|
||||
this.set('storedScrollTop-' + master.currentViewKey, $(window).scrollTop());
|
||||
if (this.hasStoredMainView(master.currentViewKey)) {
|
||||
var mainView = master.getView('main');
|
||||
if (mainView) {
|
||||
mainView.propagateEvent('remove', {ignoreCleaning: true});
|
||||
}
|
||||
master.unchainView('main');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user