|
| 1 | +import Ember from 'ember'; |
| 2 | +import UsesSettings from '../mixins/uses-settings'; |
1 | 3 | import YappModal from 'ember-modal-dialog/components/modal-dialog'; |
2 | 4 | import layout from '../templates/components/md-modal'; |
3 | 5 | import computed from 'ember-new-computed'; |
4 | 6 |
|
5 | | -export default YappModal.extend({ |
| 7 | +const { computed: { oneWay } } = Ember; |
| 8 | + |
| 9 | +export default YappModal.extend(UsesSettings, { |
6 | 10 | layout: layout, |
7 | 11 |
|
8 | | - destinationElementId: "materialize-modal-root-element", |
| 12 | + destinationElementId: oneWay('_mdSettings.modalContainerId'), |
| 13 | + |
9 | 14 | acceptsKeyResponder: true, |
10 | 15 | overlayId: 'lean-modal', |
11 | 16 | attributeBindings: ['style:inlineStyle'], |
| 17 | + concatenatedProperties: ['modalClassNames'], |
12 | 18 |
|
13 | 19 | inlineStyle: computed({ |
14 | 20 | get() { |
15 | 21 | return 'z-index: 1000;'; |
16 | 22 | } |
17 | 23 | }), |
18 | 24 |
|
| 25 | + isFooterFixed: oneWay('_mdSettings.modalIsFooterFixed'), |
| 26 | + |
| 27 | + modalClassNames: ['modal', 'show'], |
| 28 | + _modalClassString: computed('modalClassNames.@each', 'isFooterFixed', { |
| 29 | + get() { |
| 30 | + let names = this.get('modalClassNames'); |
| 31 | + if (this.get('isFooterFixed')) { |
| 32 | + names.push('modal-fixed-footer'); |
| 33 | + } |
| 34 | + return names.join(' '); |
| 35 | + } |
| 36 | + }), |
| 37 | + |
19 | 38 | didInsertElement() { |
20 | 39 | this._super(...arguments); |
21 | 40 | this.becomeKeyResponder(); |
|
0 commit comments