2015-09-17 22:20:21 +08:00
|
|
|
import Group from 'discourse/models/group';
|
|
|
|
|
2015-01-22 03:52:48 +08:00
|
|
|
export default Discourse.Route.extend({
|
2014-04-24 01:25:02 +08:00
|
|
|
|
2016-07-20 22:00:30 +08:00
|
|
|
model(params) {
|
2015-09-17 22:20:21 +08:00
|
|
|
if (params.name === 'new') {
|
2016-07-20 22:00:30 +08:00
|
|
|
return Group.create({ automatic: false, visible: true });
|
2015-09-17 22:20:21 +08:00
|
|
|
}
|
|
|
|
|
2016-07-20 22:00:30 +08:00
|
|
|
const group = this.modelFor('adminGroupsType')
|
|
|
|
.findProperty('name', params.name);
|
2014-04-24 01:25:02 +08:00
|
|
|
|
|
|
|
if (!group) { return this.transitionTo('adminGroups.index'); }
|
2015-01-22 03:52:48 +08:00
|
|
|
|
2014-04-24 01:25:02 +08:00
|
|
|
return group;
|
|
|
|
},
|
|
|
|
|
2016-07-20 22:00:30 +08:00
|
|
|
setupController(controller, model) {
|
2015-01-06 01:51:45 +08:00
|
|
|
controller.set("model", model);
|
2015-08-13 22:01:29 +08:00
|
|
|
controller.set("model.usernames", null);
|
2016-07-20 22:00:30 +08:00
|
|
|
controller.set("savingStatus", "");
|
2015-01-06 01:51:45 +08:00
|
|
|
model.findMembers();
|
2014-04-24 01:25:02 +08:00
|
|
|
}
|
2015-01-06 01:51:45 +08:00
|
|
|
|
2014-04-24 01:25:02 +08:00
|
|
|
});
|