mirror of
https://github.com/discourse/discourse.git
synced 2025-09-11 21:04:42 +08:00
Can list group members
This commit is contained in:
parent
3b1ef6ebc9
commit
2d47fe4473
9 changed files with 51 additions and 5 deletions
|
@ -0,0 +1,8 @@
|
||||||
|
Discourse.GroupController = Discourse.ObjectController.extend({
|
||||||
|
|
||||||
|
// It would be nice if bootstrap marked action lists as selected when their links
|
||||||
|
// were 'active' not the `li` tags.
|
||||||
|
showingIndex: Em.computed.equal('showing', 'index'),
|
||||||
|
showingMembers: Em.computed.equal('showing', 'members'),
|
||||||
|
});
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
Discourse.GroupIndexRoute = Discourse.Route.extend({
|
Discourse.GroupIndexRoute = Discourse.Route.extend({
|
||||||
model: function() {
|
model: function() {
|
||||||
return this.modelFor('group');
|
return this.modelFor('group');
|
||||||
|
},
|
||||||
|
|
||||||
|
setupController: function(controller, model) {
|
||||||
|
controller.set('model', model);
|
||||||
|
this.controllerFor('group').set('showing', 'index');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,7 @@ Discourse.GroupMembersRoute = Discourse.Route.extend({
|
||||||
|
|
||||||
setupController: function(controller) {
|
setupController: function(controller) {
|
||||||
controller.set('model', this.get('_members'));
|
controller.set('model', this.get('_members'));
|
||||||
|
this.controllerFor('group').set('showing', 'members');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<section class='user-navigation'>
|
<section class='user-navigation'>
|
||||||
<ul class='action-list nav-stacked'>
|
<ul class='action-list nav-stacked'>
|
||||||
<li>{{#link-to 'group.index' model}}Posts{{/link-to}}</li>
|
<li {{bind-attr class="showingIndex:active"}}>{{#link-to 'group.index' model}}{{i18n groups.posts}}{{/link-to}}</li>
|
||||||
<li>{{#link-to 'group.members' model}}Members{{/link-to}}</li>
|
<li {{bind-attr class="showingMembers:active"}}>{{#link-to 'group.members' model}}{{i18n groups.members}}{{/link-to}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{outlet}}
|
<section class='user-main'>
|
||||||
|
<section class='about'>
|
||||||
|
<div class='details'>
|
||||||
|
<h1>{{name}}</h1>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{{outlet}}
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
{{#each model}}
|
{{#each model}}
|
||||||
{{username}}
|
<div class='group-member'>
|
||||||
|
<span class='last-seen-at'>{{i18n last_seen}} {{date last_seen_at}}</span>
|
||||||
|
{{avatar this imageSize="large"}}
|
||||||
|
<h3>{{#link-to 'user' this}}{{username}}{{/link-to}}</h3>
|
||||||
|
<p>{{name}}</p>
|
||||||
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
@ -116,6 +116,19 @@
|
||||||
width: 680px;
|
width: 680px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.group-member {
|
||||||
|
img {
|
||||||
|
float: left;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
span.last-seen-at {
|
||||||
|
float: right;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
clear: both;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.user-content {
|
.user-content {
|
||||||
padding: 10px 8px;
|
padding: 10px 8px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
|
|
@ -9,7 +9,7 @@ class GroupsController < ApplicationController
|
||||||
def members
|
def members
|
||||||
group = Group.where(name: params.require(:group_id)).first
|
group = Group.where(name: params.require(:group_id)).first
|
||||||
guardian.ensure_can_see!(group)
|
guardian.ensure_can_see!(group)
|
||||||
render_serialized(group.users.order('username_lower asc').limit(200).to_a, BasicUserSerializer)
|
render_serialized(group.users.order('username_lower asc').limit(200).to_a, GroupUserSerializer)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
4
app/serializers/group_user_serializer.rb
Normal file
4
app/serializers/group_user_serializer.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class GroupUserSerializer < BasicUserSerializer
|
||||||
|
attributes :name, :last_seen_at
|
||||||
|
end
|
||||||
|
|
|
@ -174,6 +174,8 @@ en:
|
||||||
sent_by_you: "Sent by <a href='{{userUrl}}'>you</a>"
|
sent_by_you: "Sent by <a href='{{userUrl}}'>you</a>"
|
||||||
|
|
||||||
groups:
|
groups:
|
||||||
|
members: "Members"
|
||||||
|
posts: "Posts"
|
||||||
alias_levels:
|
alias_levels:
|
||||||
title: "Who can use this group as an alias?"
|
title: "Who can use this group as an alias?"
|
||||||
nobody: "Nobody"
|
nobody: "Nobody"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue