discourse-chat-integration/assets/javascripts/admin/components/channel-details.js.es6

36 lines
826 B
Plaintext
Raw Normal View History

import { popupAjaxError } from 'discourse/lib/ajax-error';
export default Ember.Component.extend({
classNames: ['channel-details'],
actions: {
refresh: function(){
this.sendAction('refresh');
},
delete(channel){
bootbox.confirm(I18n.t("chat_integration.channel_delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), result => {
if (result) {
channel.destroyRecord().then(() => {
this.send('refresh');
}).catch(popupAjaxError)
}
});
},
edit(channel){
this.sendAction('edit', channel)
},
test(channel){
this.sendAction('test', channel)
},
createRule(channel){
var newRule = this.get('store').createRecord('rule',{channel_id: channel.id});
channel.rules.pushObject(newRule)
}
}
});