Merge pull request #3045 from urbanrotnik/ur-sci-5320-tooptip-for-avatars

Tooltip for users on project cards [SCI-5320]
This commit is contained in:
Urban Rotnik 2021-01-06 09:18:00 +01:00 committed by GitHub
commit 8f11376285
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 4 deletions

View file

@ -528,7 +528,7 @@ li.module-hover {
grid-auto-rows: 2em;
grid-column-gap: 1em;
grid-row-gap: 1em;
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
width: 100%;
.table-header {
@ -771,7 +771,7 @@ li.module-hover {
grid-auto-rows: 2em;
grid-column-gap: 1em;
grid-row-gap: 1em;
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
width: 100%;
.table-header {
@ -930,6 +930,23 @@ li.module-hover {
display: none;
}
.more-users {
align-items: center;
background: $color-volcano;
border-radius: 50%;
color: $color-white;
cursor: pointer;
display: flex;
height: 2em;
justify-content: center;
margin-right: .25em;
width: 2em;
&:hover {
text-decoration: none;
}
}
.new-user {
align-items: center;
background: $color-concrete;

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('
').html_safe
end
def user_name_with_role(user_project)
"#{sanitize_input(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..3].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[4..-1].to_a %>
<% if more_users.any? %>
<a href="" class="more-users" 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',