-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathmd-modal.js
More file actions
61 lines (50 loc) · 1.17 KB
/
md-modal.js
File metadata and controls
61 lines (50 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import Ember from 'ember';
import UsesSettings from '../mixins/uses-settings';
import layout from '../templates/components/md-modal';
import {
EKMixin,
keyUp
} from 'ember-keyboard';
const {
Component,
computed,
computed: {
oneWay
},
String: {
htmlSafe
},
on
} = Ember;
export default Component.extend(EKMixin, UsesSettings, {
layout,
attributeBindings: ['style:inlineStyle'],
concatenatedProperties: ['modalClassNames'],
inlineStyle: computed(function() {
return htmlSafe('z-index: 1000;');
}),
isFooterFixed: oneWay('_mdSettings.modalIsFooterFixed'),
modalClassNames: ['modal', 'show'],
_modalClassString: computed('modalClassNames.[]', 'isFooterFixed', function() {
const names = this.get('modalClassNames').slice(0); // copies property
if (this.get('isFooterFixed')) {
names.push('modal-fixed-footer');
}
return names.join(' ');
}),
init() {
this._super(...arguments);
this.set('keyboardActivated', true);
},
_onEsc: on(keyUp('Escape'), function() {
this.cancel();
}),
cancel() {
this.sendAction('close');
},
actions: {
closeModal() {
this.sendAction('close');
}
}
});