]> source.dussan.org Git - redmine.git/commitdiff
Disable children when checking parent notifiable.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 21 Mar 2014 04:05:49 +0000 (04:05 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 21 Mar 2014 04:05:49 +0000 (04:05 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12996 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/settings_helper.rb

index 17606a3b323b855815c19b0428d409c4a8da5d42..3e672b951a2556271708cc6bd0a0a7931608de35 100644 (file)
@@ -84,12 +84,24 @@ module SettingsHelper
 
   # Renders a notification field for a Redmine::Notifiable option
   def notification_field(notifiable)
-    return content_tag(:label,
-                       check_box_tag('settings[notified_events][]',
-                                     notifiable.name,
-                                     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
+    tag_data = notifiable.parent.present? ?
+      {:parent_notifiable => notifiable.parent} :
+      {:disables => "input[data-parent-notifiable=#{notifiable.name}]"}
+
+    tag = check_box_tag('settings[notified_events][]',
+      notifiable.name,
+      Setting.notified_events.include?(notifiable.name),
+      :id => nil,
+      :data => tag_data)
+
+    text = l_or_humanize(notifiable.name, :prefix => 'label_')
+
+    options = {}
+    if notifiable.parent.present?
+      options[:class] = "parent"
+    end
+
+    content_tag(:label, tag + text, options)
   end
 
   def cross_project_subtasks_options