Skip to content

Commit

Permalink
issue/1892: added notify subview suppoprt
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster authored Dec 7, 2017
1 parent 9b567ca commit e2f0f2b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/core/js/views/notifyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ define([
setupEventListeners: function() {
this.listenTo(Adapt, {
'remove page:scrollTo': this.closeNotify,
'notify:resize': this.resetNotifySize,
'notify:close': this.closeNotify,
'device:resize': this.resetNotifySize,
'accessibility:toggle': this.onAccessibilityToggle
});
Expand Down Expand Up @@ -123,6 +125,8 @@ define([

showNotify: function() {

this.addSubView();

Adapt.trigger('notify:opened', this);

if (this.$('img').length > 0) {
Expand Down Expand Up @@ -171,6 +175,15 @@ define([

},

addSubView: function() {

this.subView = this.model.get("view");
if (!this.subView) return;

this.$(".notify-popup-content-inner").append(this.subView.$el);

},

closeNotify: function (event) {

if (this.disableAnimation) {
Expand All @@ -197,6 +210,19 @@ define([

Adapt.trigger('popup:closed');
Adapt.trigger('notify:closed');
},

remove: function() {
this.removeSubView();
Backbone.View.prototype.remove.apply(this, arguments);
},

removeSubView: function() {

if (!this.subView) return;
this.subView.remove();
this.subView = null;

}

});
Expand Down

0 comments on commit e2f0f2b

Please sign in to comment.