2016-06-15 13:49:57 -04:00
|
|
|
export default Discourse.Route.extend({
|
|
|
|
serialize(model) {
|
|
|
|
return { web_hook_id: model.get('id') || 'new' };
|
|
|
|
},
|
|
|
|
|
|
|
|
model(params) {
|
|
|
|
if (params.web_hook_id === 'new') {
|
|
|
|
return this.store.createRecord('web-hook');
|
|
|
|
}
|
|
|
|
return this.store.find('web-hook', Ember.get(params, 'web_hook_id'));
|
|
|
|
},
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
if (model.get('isNew') || Ember.isEmpty(model.get('web_hook_event_types'))) {
|
|
|
|
model.set('web_hook_event_types', controller.get('defaultEventTypes'));
|
|
|
|
}
|
|
|
|
|
|
|
|
model.set('category_ids', model.get('category_ids'));
|
|
|
|
model.set('group_ids', model.get('group_ids'));
|
|
|
|
controller.setProperties({ model, saved: false });
|
|
|
|
},
|
|
|
|
|
|
|
|
renderTemplate() {
|
2016-09-19 04:43:06 -04:00
|
|
|
this.render('admin/templates/web-hooks-show', { into: 'adminApi' });
|
2016-06-15 13:49:57 -04:00
|
|
|
}
|
|
|
|
});
|