diff app/helpers/settings_helper.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbb26bc654de
children 622f24f53b42
line wrap: on
line diff
--- a/app/helpers/settings_helper.rb	Wed Jun 27 14:54:18 2012 +0100
+++ b/app/helpers/settings_helper.rb	Mon Jan 07 12:01:42 2013 +0000
@@ -1,7 +1,7 @@
 # encoding: utf-8
 #
 # Redmine - project management software
-# Copyright (C) 2006-2011  Jean-Philippe Lang
+# Copyright (C) 2006-2012  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -44,7 +44,7 @@
     setting_values = Setting.send(setting)
     setting_values = [] unless setting_values.is_a?(Array)
 
-    setting_label(setting, options).html_safe +
+    content_tag("label", l(options[:label] || "setting_#{setting}")) +
       hidden_field_tag("settings[#{setting}][]", '').html_safe +
       choices.collect do |choice|
         text, value = (choice.is_a?(Array) ? choice : [choice, choice])
@@ -53,9 +53,10 @@
           check_box_tag(
              "settings[#{setting}][]",
              value,
-             Setting.send(setting).include?(value)
+             Setting.send(setting).include?(value),
+             :id => nil
            ) + text.to_s,
-          :class => 'block'
+          :class => (options[:inline] ? 'inline' : 'block')
          )
       end.join.html_safe
   end
@@ -72,13 +73,13 @@
 
   def setting_check_box(setting, options={})
     setting_label(setting, options).html_safe +
-      hidden_field_tag("settings[#{setting}]", 0).html_safe +
+      hidden_field_tag("settings[#{setting}]", 0, :id => nil).html_safe +
         check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), options).html_safe
   end
 
   def setting_label(setting, options={})
     label = options.delete(:label)
-    label != false ? content_tag("label", l(label || "setting_#{setting}")).html_safe : ''
+    label != false ? label_tag("settings_#{setting}", l(label || "setting_#{setting}")).html_safe : ''
   end
 
   # Renders a notification field for a Redmine::Notifiable option
@@ -86,8 +87,20 @@
     return content_tag(:label,
                        check_box_tag('settings[notified_events][]',
                                      notifiable.name,
-                                     Setting.notified_events.include?(notifiable.name)).html_safe +
+                                     Setting.notified_events.include?(notifiable.name), :id => nil).html_safe +
                          l_or_humanize(notifiable.name, :prefix => 'label_').html_safe,
                        :class => notifiable.parent.present? ? "parent" : '').html_safe
   end
+
+  def cross_project_subtasks_options
+    options = [
+      [:label_disabled, ''],
+      [:label_cross_project_system, 'system'],
+      [:label_cross_project_tree, 'tree'],
+      [:label_cross_project_hierarchy, 'hierarchy'],
+      [:label_cross_project_descendants, 'descendants']
+    ]
+
+    options.map {|label, value| [l(label), value.to_s]}
+  end
 end