New admin interface for improved channel definitions
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'tr',
|
||||
editing: false,
|
||||
|
||||
autoEdit: function(){
|
||||
if(!this.get('rule').id){
|
||||
this.set('editing', true);
|
||||
}
|
||||
}.on('init'),
|
||||
|
||||
actions: {
|
||||
edit: function(){
|
||||
this.set('editing', true);
|
||||
},
|
||||
|
||||
cancel: function(){
|
||||
this.send('refresh');
|
||||
},
|
||||
|
||||
save: function(){
|
||||
this.get('rule').save().then(result => {
|
||||
this.send('refresh');
|
||||
}).catch(popupAjaxError);
|
||||
},
|
||||
|
||||
delete(rule){
|
||||
rule.destroyRecord().then(() => {
|
||||
this.send('refresh');
|
||||
}).catch(popupAjaxError)
|
||||
},
|
||||
|
||||
refresh: function(){
|
||||
this.sendAction('refresh');
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user