2017-07-03 12:18:30 +01:00
|
|
|
import Rule from 'discourse/plugins/discourse-chat-integration/admin/models/rule'
|
2017-06-29 17:50:54 +01:00
|
|
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
2017-06-28 18:04:21 +01:00
|
|
|
import { ajax } from 'discourse/lib/ajax';
|
2017-06-29 17:50:54 +01:00
|
|
|
import { extractError } from 'discourse/lib/ajax-error';
|
2017-06-28 18:04:21 +01:00
|
|
|
|
2017-06-29 17:50:54 +01:00
|
|
|
export default Ember.Controller.extend(ModalFunctionality, {
|
2017-06-28 18:04:21 +01:00
|
|
|
|
2017-06-28 22:32:02 +01:00
|
|
|
model: Rule.create({}),
|
2017-06-29 12:56:48 +01:00
|
|
|
|
2017-06-28 18:04:21 +01:00
|
|
|
actions: {
|
|
|
|
cancel: function(){
|
|
|
|
this.send('closeModal');
|
|
|
|
},
|
2017-06-29 17:50:54 +01:00
|
|
|
|
|
|
|
save: function(){
|
|
|
|
|
|
|
|
const self = this;
|
|
|
|
|
|
|
|
this.get('model').update().then(function(result) {
|
|
|
|
self.send('closeModal');
|
|
|
|
}).catch(function(error) {
|
|
|
|
self.flash(extractError(error), 'error');
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2017-06-28 18:04:21 +01:00
|
|
|
}
|
|
|
|
});
|