2017-07-03 07:18:30 -04:00
|
|
|
import Rule from 'discourse/plugins/discourse-chat-integration/admin/models/rule'
|
2017-06-28 10:12:37 -04:00
|
|
|
import { ajax } from 'discourse/lib/ajax';
|
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
2017-06-28 13:04:21 -04:00
|
|
|
import showModal from 'discourse/lib/show-modal';
|
2017-06-29 15:19:40 -04:00
|
|
|
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
2017-06-28 13:04:21 -04:00
|
|
|
|
2017-06-28 10:12:37 -04:00
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
2017-06-29 07:56:48 -04:00
|
|
|
modalShowing: false,
|
2017-07-18 11:17:03 -04:00
|
|
|
|
2017-07-04 14:37:56 -04:00
|
|
|
anyErrors: function(){
|
|
|
|
var anyErrors = false;
|
2017-07-18 11:17:03 -04:00
|
|
|
this.get('model.channels').forEach(function(channel){
|
|
|
|
if(channel.error_key){
|
2017-07-04 14:37:56 -04:00
|
|
|
anyErrors = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return anyErrors;
|
2017-07-18 11:17:03 -04:00
|
|
|
}.property('model.channels'),
|
2017-07-04 14:37:56 -04:00
|
|
|
|
2017-06-28 13:04:21 -04:00
|
|
|
actions:{
|
2017-07-18 11:17:03 -04:00
|
|
|
createChannel(){
|
2017-06-29 15:19:40 -04:00
|
|
|
this.set('modalShowing', true);
|
2017-07-18 11:17:03 -04:00
|
|
|
var model = {channel: this.store.createRecord('channel',{provider: this.get('model.provider').id, data:{}},), provider:this.get('model.provider')};
|
|
|
|
showModal('admin-plugins-chat-edit-channel', { model: model, admin: true });
|
2017-06-29 15:19:40 -04:00
|
|
|
},
|
2017-07-18 11:17:03 -04:00
|
|
|
editChannel(channel){
|
2017-06-29 07:56:48 -04:00
|
|
|
this.set('modalShowing', true);
|
2017-07-18 11:17:03 -04:00
|
|
|
var model = {channel: channel, provider: this.get('model.provider')};
|
|
|
|
showModal('admin-plugins-chat-edit-channel', { model: model, admin: true });
|
2017-06-29 15:19:40 -04:00
|
|
|
},
|
2017-07-18 11:17:03 -04:00
|
|
|
testChannel(channel){
|
|
|
|
this.set('modalShowing', true);
|
|
|
|
var model = {channel:channel}
|
|
|
|
showModal('admin-plugins-chat-test', { model: model, admin: true });
|
|
|
|
},
|
2017-06-29 07:56:48 -04:00
|
|
|
|
2017-06-28 13:04:21 -04:00
|
|
|
}
|
2017-06-28 10:12:37 -04:00
|
|
|
|
|
|
|
});
|