Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2444 from vogdb/issue-2444
Browse files Browse the repository at this point in the history
reload of popOut Component.
  • Loading branch information
vogdb authored Dec 7, 2016
2 parents 5dc2d63 + 6fb1e63 commit b4d9f77
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
if (this.$parent.length) {
this.$parent.append($element);
}
this.$floatbox.trigger('floatbox-close');
$element.removeData('floatbox');
this.$layer.remove();
$viewport.children('.floatbox-layer:last').addClass('active');
Expand Down
21 changes: 13 additions & 8 deletions library/CM/Component/Abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,23 @@ var CM_Component_Abstract = CM_View_Abstract.extend({
return $(selector, this.el);
},

popOut: function(options) {
/**
* @param {Object} [options]
* @param {Boolean} [removeOnClose]
*/
popOut: function(options, removeOnClose) {
this.repaint();
this.$el.floatbox(options);
//we don't use `this.$el.floatbox(options);` cause `this` component can be reloaded.
var floatbox = new $.floatbox(options);
floatbox.show(this.$el);
this.repaint();

var self = this;
this.$el.one('floatbox-close', function() {
if (cm.window.isHidden(self.el)) {
if (removeOnClose) {
var self = this;
floatbox.$floatbox.one('floatbox-close', function() {
self.remove();
}
return false;
});
});
}
},

popIn: function() {
Expand Down
2 changes: 1 addition & 1 deletion library/CM/View/Abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ var CM_View_Abstract = Backbone.View.extend({
popOutComponent: function(className, params, options) {
return this.prepareComponent(className, params, options)
.then(function(component) {
component.popOut();
component.popOut({}, true);
return component;
});
},
Expand Down

0 comments on commit b4d9f77

Please sign in to comment.