summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-03-15 11:49:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-03-15 11:49:51 +0000
commitccda34cac6267fa95bb17cf458078565ff5f8822 (patch)
treeb3611e539e72bfa44bc1ee0f14a68fb834fcd3c5 /app/helpers
parente26ab0d4a251cc8fcd476a6140bccfcd24a9c446 (diff)
downloadredmine-ccda34cac6267fa95bb17cf458078565ff5f8822.tar.gz
redmine-ccda34cac6267fa95bb17cf458078565ff5f8822.zip
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
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb14
1 files changed, 14 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:
#