Disable children when checking parent notifiable.

git-svn-id: http://svn.redmine.org/redmine/trunk@12996 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-03-21 04:05:49 +00:00
parent ddcad64aa2
commit d50ec43dff

View File

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