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({
|
||||
|
||||
modalShowing: false,
|
||||
|
||||
actions:{
|
||||
edit(rule){
|
||||
console.log(rule.hasDirtyAttributes);
|
||||
this.set('modalShowing', true);
|
||||
showModal('admin-plugins-chat-edit-rule', { model: rule, admin: true });
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
});
|
|
@ -4,11 +4,10 @@ import { ajax } from 'discourse/lib/ajax';
|
|||
export default Ember.Controller.extend({
|
||||
|
||||
model: Rule.create({}),
|
||||
|
||||
|
||||
actions: {
|
||||
cancel: function(){
|
||||
this.set('model', null);
|
||||
this.set('workingCopy', null);
|
||||
|
||||
this.send('closeModal');
|
||||
},
|
||||
}
|
||||
|
|
|
@ -4,23 +4,22 @@ import { ajax } from 'discourse/lib/ajax';
|
|||
export default Discourse.Route.extend({
|
||||
|
||||
model(params, transition) {
|
||||
console.log("Loading rules for "+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) {
|
||||
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…
Reference in New Issue