From d53491a62bd063ad2cb57804630b461e5f5630cf Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sat, 30 Nov 2019 18:11:12 +0900 Subject: [PATCH 2/2] Show Gravatar icons in the Members tab in the project setting --- app/helpers/avatars_helper.rb | 13 +++++++++++++ app/views/projects/settings/_members.html.erb | 4 +++- public/stylesheets/application.css | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index 8cf3da970..ee3bd429a 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -34,6 +34,19 @@ module AvatarsHelper avatar(user, options).to_s.html_safe end + def principal_avatar(principal, options={}) + return '' unless principal + + options[:title] = l(:"label_#{principal.class.name.downcase}") + ': ' + principal.name + if principal.is_a?(User) + avatar(principal, options).to_s.html_safe + elsif principal.is_a?(Group) + image_tag('group.png', options).to_s.html_safe + else + '' + end + end + # Returns the avatar image tag for the given +user+ if avatars are enabled # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe ') def avatar(user, options = { }) diff --git a/app/views/projects/settings/_members.html.erb b/app/views/projects/settings/_members.html.erb index 6dab1c294..aac1f07b4 100644 --- a/app/views/projects/settings/_members.html.erb +++ b/app/views/projects/settings/_members.html.erb @@ -19,7 +19,9 @@ <% members.each do |member| %> <% next if member.new_record? %> - <%= link_to_user member.principal %> + + <%= principal_avatar(member.principal, :size => "14") %>
<%= link_to_user member.principal %>
+ <%= member.roles.sort.collect(&:to_s).join(', ') %>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 2fc541bc0..3079a7633 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -306,6 +306,8 @@ table.files tbody th {text-align:left;} table.files tr.file td.filename { text-align: left; padding-left: 24px; } table.files tr.file td.digest { font-size: 80%; } +table.members td.name img { position: absolute; } +table.members td.name div { padding-left: 20px; } table.members td.roles, table.memberships td.roles { width: 45%; } table.messages td.last_message {text-align:left;} -- 2.21.0 (Apple Git-122.2)