summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_helper.rb14
-rw-r--r--app/views/users/show.html.erb12
2 files changed, 26 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8ccdf0736..7174575be 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -65,6 +65,20 @@ module ApplicationHelper
end
end
+ # Displays a link to edit group page if current user is admin
+ # Otherwise display only the group name
+ def link_to_group(group, options={})
+ if group.is_a?(Group)
+ name = h(group.name)
+ if (User.current.admin?)
+ only_path = options[:only_path].nil? ? true : options[:only_path]
+ link_to name, edit_group_path(group, :only_path => only_path)
+ else
+ name
+ end
+ end
+ end
+
# Displays a link to +issue+ with its subject.
# Examples:
#
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index c5c17000b..66a2a46a3 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -84,6 +84,18 @@
<% end %>
</ul>
<% end %>
+
+<% if (User.current == @user || User.current.admin?) && @user.groups.any? %>
+<div id="groups">
+ <h3><%=l(:label_group_plural)%></h3>
+ <ul>
+ <% for group in @user.groups %>
+ <li><%= link_to_group(group) %>
+ <% end %>
+ </ul>
+</div>
+<% end %>
+
<%= call_hook :view_account_left_bottom, :user => @user %>
</div>