From 215eae9972e680a43fd5e5bcdb9a32d628c24bd5 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 25 Jul 2016 14:21:27 -0400 Subject: [PATCH] FIX: Add a `title` to the groups pages --- .../discourse/routes/group-index.js.es6 | 5 +++++ .../discourse/routes/group-posts.js.es6 | 4 ++++ .../javascripts/discourse/routes/group.js.es6 | 22 +++++++++---------- app/views/default/empty.html.erb | 2 +- config/locales/client.en.yml | 1 + 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/discourse/routes/group-index.js.es6 b/app/assets/javascripts/discourse/routes/group-index.js.es6 index c6e00e802..5182e0978 100644 --- a/app/assets/javascripts/discourse/routes/group-index.js.es6 +++ b/app/assets/javascripts/discourse/routes/group-index.js.es6 @@ -1,4 +1,9 @@ export default Discourse.Route.extend({ + + titleToken() { + return I18n.t('groups.members'); + }, + model() { return this.modelFor("group"); }, diff --git a/app/assets/javascripts/discourse/routes/group-posts.js.es6 b/app/assets/javascripts/discourse/routes/group-posts.js.es6 index fb60caa1e..25ee29e4d 100644 --- a/app/assets/javascripts/discourse/routes/group-posts.js.es6 +++ b/app/assets/javascripts/discourse/routes/group-posts.js.es6 @@ -2,6 +2,10 @@ export function buildGroupPage(type) { return Discourse.Route.extend({ type, + titleToken() { + return I18n.t(`groups.${type}`); + }, + model() { return this.modelFor("group").findPosts({ type }); }, diff --git a/app/assets/javascripts/discourse/routes/group.js.es6 b/app/assets/javascripts/discourse/routes/group.js.es6 index 21b5aad57..51724c18b 100644 --- a/app/assets/javascripts/discourse/routes/group.js.es6 +++ b/app/assets/javascripts/discourse/routes/group.js.es6 @@ -2,25 +2,25 @@ import Group from 'discourse/models/group'; export default Discourse.Route.extend({ - model: function(params) { + titleToken() { + return [ this.modelFor('group').get('name') ]; + }, + + model(params) { return Group.find(params.name); }, - serialize: function(model) { + serialize(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); + afterModel(model) { + return Group.findGroupCounts(model.get('name')).then(counts => { + this.set('counts', counts); }); }, - setupController: function(controller, model) { - controller.setProperties({ - model: model, - counts: this.get('counts') - }); + setupController(controller, model) { + controller.setProperties({ model, counts: this.get('counts') }); } }); diff --git a/app/views/default/empty.html.erb b/app/views/default/empty.html.erb index 7b4d68d70..c6cac6926 100644 --- a/app/views/default/empty.html.erb +++ b/app/views/default/empty.html.erb @@ -1 +1 @@ -empty \ No newline at end of file +empty diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index e538562fc..1941b7249 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -388,6 +388,7 @@ en: selector_placeholder: "Add members" owner: "owner" visible: "Group is visible to all users" + index: "Groups" title: one: "group" other: "groups"