Skip to content

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

Fix group memberships tab of user

Oliver Güntherac54dd15d90a
diff --git a/app/views/users/_groups.html.erb b/app/views/users/_groups.html.erb
index 3fbe4289df8..52022075b54 100644
--- a/app/views/users/_groups.html.erb
+++ b/app/views/users/_groups.html.erb
@@ -26,12 +26,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See docs/COPYRIGHT.rdoc for more details.
++#%>
+<% groups = @user.groups.pluck(:id, :lastname) %>
+
<%= labelled_tabular_form_for(:user, url: { action: 'update' }, html: {method: :put}) do %>
- <%= link_to t(:label_manage_groups), groups_path, class: 'button -highlight' %>
<section class="form--section">
- <% Group.all.sort.each do |group| %>
+ <% if groups.empty? %>
+ <%= no_results_box action_url: groups_path,
+ display_action: true,
+ custom_title: t('users.groups.no_results_title_text'),
+ custom_action_text: t(:label_manage_groups)
+ %>
+ <% else %>
+ <p><%= t('users.groups.member_in_these_groups') %></p>
+ <% end %>
+
+ <% groups.each do |id, name| %>
<ul>
- <li><%= link_to group.name, group_path(group) %></li>
+ <li><%= link_to name, edit_group_path(id) %></li>
</ul>
<% end %>
</section>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d84852762d2..6663fd66b6a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -263,6 +263,9 @@ en:
no_results_content_text: Add a news item
users:
+ 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.
memberships:
no_results_title_text: This user is currently not a member of a project.