From ccda34cac6267fa95bb17cf458078565ff5f8822 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 15 Mar 2019 11:49:51 +0000 Subject: Display user's groups on profile (#12796). Only for admins or when viewing its own profile. git-svn-id: http://svn.redmine.org/redmine/trunk@17973 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/helpers') 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: # -- cgit v1.2.3