diff --git a/app/assets/javascripts/discourse/controllers/group_controller.js b/app/assets/javascripts/discourse/controllers/group_controller.js new file mode 100644 index 00000000000..c6efff8fe43 --- /dev/null +++ b/app/assets/javascripts/discourse/controllers/group_controller.js @@ -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'), +}); + diff --git a/app/assets/javascripts/discourse/routes/group_index_route.js b/app/assets/javascripts/discourse/routes/group_index_route.js index 94443edbebe..675b35b432b 100644 --- a/app/assets/javascripts/discourse/routes/group_index_route.js +++ b/app/assets/javascripts/discourse/routes/group_index_route.js @@ -1,5 +1,10 @@ Discourse.GroupIndexRoute = Discourse.Route.extend({ model: function() { return this.modelFor('group'); + }, + + setupController: function(controller, model) { + controller.set('model', model); + this.controllerFor('group').set('showing', 'index'); } }); diff --git a/app/assets/javascripts/discourse/routes/group_members_route.js b/app/assets/javascripts/discourse/routes/group_members_route.js index fb9902e8649..3ac3a06a31f 100644 --- a/app/assets/javascripts/discourse/routes/group_members_route.js +++ b/app/assets/javascripts/discourse/routes/group_members_route.js @@ -12,6 +12,7 @@ Discourse.GroupMembersRoute = Discourse.Route.extend({ setupController: function(controller) { controller.set('model', this.get('_members')); + this.controllerFor('group').set('showing', 'members'); } }); diff --git a/app/assets/javascripts/discourse/templates/group.js.handlebars b/app/assets/javascripts/discourse/templates/group.js.handlebars index ab50f0e5add..97e47554f66 100644 --- a/app/assets/javascripts/discourse/templates/group.js.handlebars +++ b/app/assets/javascripts/discourse/templates/group.js.handlebars @@ -1,10 +1,18 @@
- {{outlet}} +
+
+
+

{{name}}

+
+
+ + {{outlet}} +
diff --git a/app/assets/javascripts/discourse/templates/group/members.js.handlebars b/app/assets/javascripts/discourse/templates/group/members.js.handlebars index 28dfe59ec23..07044e03b86 100644 --- a/app/assets/javascripts/discourse/templates/group/members.js.handlebars +++ b/app/assets/javascripts/discourse/templates/group/members.js.handlebars @@ -1,3 +1,8 @@ {{#each model}} - {{username}} +
+ {{i18n last_seen}} {{date last_seen_at}} + {{avatar this imageSize="large"}} +

{{#link-to 'user' this}}{{username}}{{/link-to}}

+

{{name}}

+
{{/each}} diff --git a/app/assets/stylesheets/desktop/user.scss b/app/assets/stylesheets/desktop/user.scss index 1a642fa27b1..9d4d09e82de 100644 --- a/app/assets/stylesheets/desktop/user.scss +++ b/app/assets/stylesheets/desktop/user.scss @@ -116,6 +116,19 @@ width: 680px; } + .group-member { + img { + float: left; + margin-right: 10px; + } + span.last-seen-at { + float: right; + color: #999; + } + clear: both; + + } + .user-content { padding: 10px 8px; background-color: white; diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index fbf2321bd6e..75fff2aa31f 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -9,7 +9,7 @@ class GroupsController < ApplicationController def members group = Group.where(name: params.require(:group_id)).first 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 diff --git a/app/serializers/group_user_serializer.rb b/app/serializers/group_user_serializer.rb new file mode 100644 index 00000000000..a42afab1944 --- /dev/null +++ b/app/serializers/group_user_serializer.rb @@ -0,0 +1,4 @@ +class GroupUserSerializer < BasicUserSerializer + attributes :name, :last_seen_at +end + diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 0e6a0d446d5..820ca9d7494 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -174,6 +174,8 @@ en: sent_by_you: "Sent by you" groups: + members: "Members" + posts: "Posts" alias_levels: title: "Who can use this group as an alias?" nobody: "Nobody"