2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 09:10:25 +08:00
discourse/app/assets/javascripts/discourse/routes/group.js.es6
Sam c0b277d273 REFACTOR: support booting discourse with DISCOURSE_NO_CONSTANTS
This change is discussed here: https://meta.discourse.org/t/deprecating-es6-compatibility-layer/35821

Prior to this change we were not booting correctly with DISCOURSE_NO_CONSTANTS
2015-11-21 00:14:50 +11:00

26 lines
574 B
JavaScript

import Group from 'discourse/models/group';
export default Discourse.Route.extend({
model: function(params) {
return Group.find(params.name);
},
serialize: function(model) {
return { name: model.get('name').toLowerCase() };
},
afterModel: function(model) {
var self = this;
return Group.findGroupCounts(model.get('name')).then(function (counts) {
self.set('counts', counts);
});
},
setupController: function(controller, model) {
controller.setProperties({
model: model,
counts: this.get('counts')
});
}
});