OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#55581] link to groups instead of projects
Tobias Dillmann8ef34861acd5
diff --git a/app/components/users/hover_card_component.html.erb b/app/components/users/hover_card_component.html.erbindex bc82f774d1b..a7b79af7f7a 100644--- a/app/components/users/hover_card_component.html.erb+++ b/app/components/users/hover_card_component.html.erb@@ -55,7 +55,7 @@ See COPYRIGHT and LICENSE files for more details.endf.with_column do- render(Primer::Beta::Text.new(color: :muted)) { project_membership_summary }+ render(Primer::Beta::Text.new(color: :muted)) { group_membership_summary }endendenddiff --git a/app/components/users/hover_card_component.rb b/app/components/users/hover_card_component.rbindex f22870a89e6..9c6753d03fe 100644--- a/app/components/users/hover_card_component.rb+++ b/app/components/users/hover_card_component.rb@@ -43,31 +43,31 @@ class Users::HoverCardComponent < ApplicationComponentend# Constructs a string in the form of:- # "Member of project4, project5"+ # "Member of group4, group5"# or- # "Member of project1, project2 and 3 more"- # The latter string is cut off since the complete list of project names would exceed the allowed `max_length`.- def project_membership_summary(max_length = 40)- projects = @user.projects- return no_project_text if projects.empty?+ # "Member of group1, group2 and 3 more"+ # The latter string is cut off since the complete list of group names would exceed the allowed `max_length`.+ def group_membership_summary(max_length = 40)+ groups = @user.groups+ return no_group_text if groups.empty?- project_links = linked_project_names(projects)+ group_links = linked_group_names(groups)- cutoff_index = calculate_cutoff_index(projects.map(&:name), max_length)- build_summary(project_links, cutoff_index)+ cutoff_index = calculate_cutoff_index(groups.map(&:name), max_length)+ build_summary(group_links, cutoff_index)endprivate- def linked_project_names(projects)- projects.map { |project| link_to(h(project.name), project_path(project)) }+ def linked_group_names(groups)+ groups.map { |group| link_to(h(group.name), show_group_path(group)) }end- def no_project_text- t("users.memberships.no_results_title_text")+ def no_group_text+ t("users.groups.no_results_title_text")end- # Calculate the index at which to cut off the project names, based on plain text length+ # Calculate the index at which to cut off the group names, based on plain text lengthdef calculate_cutoff_index(names, max_length)current_length = 0@@ -86,9 +86,9 @@ class Users::HoverCardComponent < ApplicationComponentremaining_count = links.size - cutoff_indexif remaining_count > 0- t("users.memberships.summary_with_more", names: summary_links, count: remaining_count).html_safe+ t("users.groups.summary_with_more", names: summary_links, count: remaining_count).html_safeelse- t("users.memberships.summary", names: summary_links).html_safe+ t("users.groups.summary", names: summary_links).html_safeendendenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 598d2335780..23ebbb86740 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -539,10 +539,10 @@ en:groups:member_in_these_groups: "This user is currently a member of the following groups:"no_results_title_text: This user is currently not a member in any group.+ summary_with_more: Member of %{names} and %{count} more.+ summary: Member of %{names}.memberships:no_results_title_text: This user is currently not a member of a project.- summary_with_more: Member of %{names} and %{count} more- summary: Member of %{names}page:text: "Text"placeholder_users: