mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Include members count on groups page.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.GroupController = Discourse.ObjectController.extend({
|
||||
postsCount: null,
|
||||
counts: null,
|
||||
|
||||
// It would be nice if bootstrap marked action lists as selected when their links
|
||||
// were 'active' not the `li` tags.
|
||||
|
||||
@@ -154,9 +154,9 @@ Discourse.Group.reopenClass({
|
||||
});
|
||||
},
|
||||
|
||||
findPostsCount: function(name) {
|
||||
return Discourse.ajax("/groups/" + name + "/posts_count.json").then(function(g) {
|
||||
return g.posts_count;
|
||||
findGroupCounts: function(name) {
|
||||
return Discourse.ajax("/groups/" + name + "/counts.json").then(function (result) {
|
||||
return Em.Object.create(result.counts);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@ Discourse.GroupRoute = Discourse.Route.extend({
|
||||
|
||||
afterModel: function(model) {
|
||||
var self = this;
|
||||
return Discourse.Group.findPostsCount(model.get('name')).then(function (c) {
|
||||
self.set('postsCount', c);
|
||||
return Discourse.Group.findGroupCounts(model.get('name')).then(function (counts) {
|
||||
self.set('counts', counts);
|
||||
});
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
controller.setProperties({
|
||||
model: model,
|
||||
postsCount: this.get('postsCount')
|
||||
counts: this.get('counts')
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
<ul class='action-list nav-stacked'>
|
||||
<li {{bind-attr class="showingIndex:active"}}>
|
||||
{{#link-to 'group.index' model}}{{i18n groups.posts}}
|
||||
<span class='count'>({{postsCount}})</span>
|
||||
<span class='count'>({{counts.posts}})</span>
|
||||
<span class='fa fa-chevron-right'></span>{{/link-to}}
|
||||
</li>
|
||||
<li {{bind-attr class="showingMembers:active"}}>
|
||||
{{#link-to 'group.members' model}}{{i18n groups.members}}
|
||||
<span class='count'>({{counts.members}})</span>
|
||||
<span class='fa fa-chevron-right'></span>{{/link-to}}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user