mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-07-08 14:42:44 +00:00
Refresh the list of rules when the modal dialog closes
This commit is contained in:
parent
8e0bec6e6f
commit
304d8f962f
@ -5,13 +5,14 @@ import showModal from 'discourse/lib/show-modal';
|
|||||||
|
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
|
modalShowing: false,
|
||||||
|
|
||||||
actions:{
|
actions:{
|
||||||
edit(rule){
|
edit(rule){
|
||||||
console.log(rule.hasDirtyAttributes);
|
this.set('modalShowing', true);
|
||||||
showModal('admin-plugins-chat-edit-rule', { model: rule, admin: true });
|
showModal('admin-plugins-chat-edit-rule', { model: rule, admin: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
@ -7,8 +7,7 @@ export default Ember.Controller.extend({
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
cancel: function(){
|
cancel: function(){
|
||||||
this.set('model', null);
|
|
||||||
this.set('workingCopy', null);
|
|
||||||
this.send('closeModal');
|
this.send('closeModal');
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -4,23 +4,22 @@ import { ajax } from 'discourse/lib/ajax';
|
|||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
model(params, transition) {
|
model(params, transition) {
|
||||||
console.log("Loading rules for "+params.provider)
|
|
||||||
return this.store.find('rule', {provider: params.provider});
|
return this.store.find('rule', {provider: params.provider});
|
||||||
|
|
||||||
// var url = '/admin/plugins/chat'
|
|
||||||
// if(params.provider !== undefined){
|
|
||||||
// url += `/${params.provider}`
|
|
||||||
// }
|
|
||||||
// url += '.json'
|
|
||||||
|
|
||||||
// return ajax(url).then(result => {
|
|
||||||
// var rules = result.rules.map(v => FilterRule.create(v))
|
|
||||||
// var providers = result.providers
|
|
||||||
// return {provider: result.provider, rules: rules, providers: providers};
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
|
|
||||||
serialize: function(model, params) {
|
serialize: function(model, params) {
|
||||||
return { provider: model['provider']};
|
return { provider: model['provider']};
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
closeModal: function(data){
|
||||||
|
if(this.get('controller.modalShowing')){
|
||||||
|
this.refresh();
|
||||||
|
this.set('controller.modalShowing', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // Continue bubbling up, so the modal actually closes
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user