Add tooltips for users on project cards

This commit is contained in:
Urban Rotnik 2021-01-04 16:44:31 +01:00
parent 163a2d1e60
commit cd43973952
2 changed files with 17 additions and 2 deletions

View file

@ -5,6 +5,14 @@ module ProjectsHelper
t('user_projects.enums.role.' + user_project.role)
end
def user_names_with_roles(user_projects)
user_projects.map { |up| user_name_with_role(up) }.join('
')
end
def user_name_with_role(user_project)
"#{user_project.user.name} - #{I18n.t("user_projects.enums.role.#{user_project.role}")}"
end
def construct_module_connections(my_module)
conns = []
my_module.outputs.each do |output|

View file

@ -37,12 +37,19 @@
<span class="card-label"><%= t('projects.index.card.users') %></span>
<div class="value">
<% project.users.each do |user| %>
<% project.user_projects[0..4].each do |user_project| %>
<span class="global-avatar-container">
<%= image_tag avatar_path(user, :icon_small) %>
<%= image_tag(avatar_path(user_project.user, :icon_small), title: user_name_with_role(user_project)) %>
</span>
<% end %>
<% more_users = project.user_projects[5..-1].to_a %>
<% if more_users.any? %>
<a href="" title="<%= user_names_with_roles(more_users) %>">
+ <%= more_users.size %>
</a>
<% end %>
<% if project.active? %>
<%= link_to project_users_edit_path(project),
class: 'manage-users-link',