FIX: Add a title to the groups pages

This commit is contained in:
Robin Ward 2016-07-25 14:21:27 -04:00
parent b0f7e4ba00
commit 215eae9972
5 changed files with 22 additions and 12 deletions

View file

@ -1,4 +1,9 @@
export default Discourse.Route.extend({ export default Discourse.Route.extend({
titleToken() {
return I18n.t('groups.members');
},
model() { model() {
return this.modelFor("group"); return this.modelFor("group");
}, },

View file

@ -2,6 +2,10 @@ export function buildGroupPage(type) {
return Discourse.Route.extend({ return Discourse.Route.extend({
type, type,
titleToken() {
return I18n.t(`groups.${type}`);
},
model() { model() {
return this.modelFor("group").findPosts({ type }); return this.modelFor("group").findPosts({ type });
}, },

View file

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

View file

@ -388,6 +388,7 @@ en:
selector_placeholder: "Add members" selector_placeholder: "Add members"
owner: "owner" owner: "owner"
visible: "Group is visible to all users" visible: "Group is visible to all users"
index: "Groups"
title: title:
one: "group" one: "group"
other: "groups" other: "groups"