Better support for inline modals
This commit is contained in:
parent
a48abc6556
commit
75b2aa2edd
|
@ -1,10 +1,17 @@
|
|||
export default Ember.Component.extend({
|
||||
classNames: ['modal-body'],
|
||||
fixed: false,
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
$('#modal-alert').hide();
|
||||
$('.d-modal.fixed-modal').modal('show');
|
||||
|
||||
let fixedParent = this.$().closest('.d-modal.fixed-modal');
|
||||
if (fixedParent.length) {
|
||||
this.set('fixed', true);
|
||||
fixedParent.modal('show');
|
||||
}
|
||||
|
||||
Ember.run.scheduleOnce('afterRender', this, this._afterFirstRender);
|
||||
this.appEvents.on('modal-body:flash', msg => this._flash(msg));
|
||||
},
|
||||
|
@ -28,7 +35,14 @@ export default Ember.Component.extend({
|
|||
}
|
||||
}
|
||||
|
||||
this.appEvents.trigger('modal:body-shown', this.getProperties('title', 'rawTitle'));
|
||||
this.appEvents.trigger(
|
||||
'modal:body-shown',
|
||||
this.getProperties(
|
||||
'title',
|
||||
'rawTitle',
|
||||
'fixed'
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
_flash(msg) {
|
||||
|
|
|
@ -27,7 +27,11 @@ export default Ember.Component.extend({
|
|||
});
|
||||
|
||||
this.appEvents.on('modal:body-shown', data => {
|
||||
this.$().removeClass('hidden');
|
||||
if (this.isDestroying || this.isDestroyed) { return; }
|
||||
if (data.fixed) {
|
||||
this.$().removeClass('hidden');
|
||||
}
|
||||
|
||||
if (data.title) {
|
||||
this.set('title', I18n.t(data.title));
|
||||
} else if (data.rawTitle) {
|
||||
|
|
Loading…
Reference in New Issue