2015-11-21 00:14:50 +11:00
|
|
|
import Group from 'discourse/models/group';
|
|
|
|
|
2014-07-28 13:39:20 -04:00
|
|
|
export default Discourse.Route.extend({
|
2014-01-30 17:10:36 -05:00
|
|
|
|
2014-02-06 16:14:32 -05:00
|
|
|
model: function(params) {
|
2015-11-21 00:14:50 +11:00
|
|
|
return Group.find(params.name);
|
2014-02-06 13:06:19 -05:00
|
|
|
},
|
2014-01-30 17:10:36 -05:00
|
|
|
|
2014-02-18 16:43:02 -05:00
|
|
|
serialize: function(model) {
|
|
|
|
return { name: model.get('name').toLowerCase() };
|
|
|
|
},
|
|
|
|
|
2014-02-12 14:00:45 -05:00
|
|
|
afterModel: function(model) {
|
|
|
|
var self = this;
|
2015-11-21 00:14:50 +11:00
|
|
|
return Group.findGroupCounts(model.get('name')).then(function (counts) {
|
2014-02-18 16:17:04 -05:00
|
|
|
self.set('counts', counts);
|
2014-02-12 14:00:45 -05:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
setupController: function(controller, model) {
|
|
|
|
controller.setProperties({
|
|
|
|
model: model,
|
2014-02-18 16:17:04 -05:00
|
|
|
counts: this.get('counts')
|
2014-02-12 14:00:45 -05:00
|
|
|
});
|
|
|
|
}
|
2014-01-30 17:10:36 -05:00
|
|
|
});
|