application_helper.rb-PATCH.txt

Todd McGrath, 2008-02-03 10:48

Download (970 Bytes)

 
1
Index: C:/rubyworkspace/redmine-trunk/app/helpers/application_helper.rb
2
===================================================================
3
--- C:/rubyworkspace/redmine-trunk/app/helpers/application_helper.rb	(revision 127)
4
+++ C:/rubyworkspace/redmine-trunk/app/helpers/application_helper.rb	(working copy)
5
@@ -44,6 +44,11 @@
6
   def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
7
     link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])
8
   end
9
+  
10
+  # Display a link if user is authorized
11
+  def link_to_if_authorized_li(name, options = {}, html_options = nil, *parameters_for_method_reference)
12
+    "<li>" + link_to(name, options, html_options, *parameters_for_method_reference) + "</li>" if authorize_for(options[:controller], options[:action])
13
+  end  
14
 
15
   # Display a link to user's account page
16
   def link_to_user(user)