2014-03-31 08:07:05 +04:00
|
|
|
var ModalDialog = Ember.Component.extend({
|
|
|
|
didInsertElement: function () {
|
|
|
|
this.$('#modal-container').fadeIn(50);
|
|
|
|
|
|
|
|
this.$('.modal-background').show().fadeIn(10, function () {
|
|
|
|
$(this).addClass('in');
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$('.js-modal').addClass('in');
|
|
|
|
},
|
|
|
|
|
|
|
|
willDestroyElement: function () {
|
|
|
|
|
|
|
|
this.$('.js-modal').removeClass('in');
|
|
|
|
|
|
|
|
this.$('.modal-background').removeClass('in');
|
|
|
|
|
|
|
|
return this._super();
|
|
|
|
},
|
|
|
|
|
2014-06-04 01:10:54 +04:00
|
|
|
confirmaccept: 'confirmAccept',
|
|
|
|
confirmreject: 'confirmReject',
|
|
|
|
|
2014-03-31 08:07:05 +04:00
|
|
|
actions: {
|
|
|
|
closeModal: function () {
|
|
|
|
this.sendAction();
|
|
|
|
},
|
|
|
|
confirm: function (type) {
|
2014-06-04 01:10:54 +04:00
|
|
|
this.sendAction('confirm' + type);
|
2014-03-31 08:07:05 +04:00
|
|
|
this.sendAction();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-07-30 05:57:19 +04:00
|
|
|
klass: Ember.computed('type', 'style', 'animation', function () {
|
2014-03-31 08:07:05 +04:00
|
|
|
var classNames = [];
|
|
|
|
|
|
|
|
classNames.push(this.get('type') ? 'modal-' + this.get('type') : 'modal');
|
|
|
|
|
|
|
|
if (this.get('style')) {
|
|
|
|
this.get('style').split(',').forEach(function (style) {
|
|
|
|
classNames.push('modal-style-' + style);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
classNames.push(this.get('animation'));
|
|
|
|
|
|
|
|
return classNames.join(' ');
|
2014-07-30 05:57:19 +04:00
|
|
|
}),
|
|
|
|
|
|
|
|
acceptButtonClass: Ember.computed('confirm.accept.buttonClass', function () {
|
2014-08-06 15:34:08 +04:00
|
|
|
return this.get('confirm.accept.buttonClass') ? this.get('confirm.accept.buttonClass') : 'btn btn-green';
|
2014-07-30 05:57:19 +04:00
|
|
|
}),
|
2014-03-31 08:07:05 +04:00
|
|
|
|
2014-07-30 05:57:19 +04:00
|
|
|
rejectButtonClass: Ember.computed('confirm.reject.buttonClass', function () {
|
2014-08-06 15:34:08 +04:00
|
|
|
return this.get('confirm.reject.buttonClass') ? this.get('confirm.reject.buttonClass') : 'btn btn-red';
|
2014-07-30 05:57:19 +04:00
|
|
|
})
|
2014-03-31 08:07:05 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
export default ModalDialog;
|