Rails3: helper: use html_safe in SettingsHelper
Contributed by Sylvain Utard. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7544 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
33d41583bb
commit
5d297091fe
|
@ -32,18 +32,18 @@ module SettingsHelper
|
|||
if blank_text = options.delete(:blank)
|
||||
choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices
|
||||
end
|
||||
setting_label(setting, options) +
|
||||
setting_label(setting, options).html_safe +
|
||||
select_tag("settings[#{setting}]",
|
||||
options_for_select(choices, Setting.send(setting).to_s),
|
||||
options)
|
||||
options).html_safe
|
||||
end
|
||||
|
||||
def setting_multiselect(setting, choices, options={})
|
||||
setting_values = Setting.send(setting)
|
||||
setting_values = [] unless setting_values.is_a?(Array)
|
||||
|
||||
setting_label(setting, options) +
|
||||
hidden_field_tag("settings[#{setting}][]", '') +
|
||||
setting_label(setting, options).html_safe +
|
||||
hidden_field_tag("settings[#{setting}][]", '').html_safe +
|
||||
choices.collect do |choice|
|
||||
text, value = (choice.is_a?(Array) ? choice : [choice, choice])
|
||||
content_tag(
|
||||
|
@ -55,28 +55,28 @@ module SettingsHelper
|
|||
) + text.to_s,
|
||||
:class => 'block'
|
||||
)
|
||||
end.join
|
||||
end.join.html_safe
|
||||
end
|
||||
|
||||
def setting_text_field(setting, options={})
|
||||
setting_label(setting, options) +
|
||||
text_field_tag("settings[#{setting}]", Setting.send(setting), options)
|
||||
setting_label(setting, options).html_safe +
|
||||
text_field_tag("settings[#{setting}]", Setting.send(setting), options).html_safe
|
||||
end
|
||||
|
||||
def setting_text_area(setting, options={})
|
||||
setting_label(setting, options) +
|
||||
text_area_tag("settings[#{setting}]", Setting.send(setting), options)
|
||||
setting_label(setting, options).html_safe +
|
||||
text_area_tag("settings[#{setting}]", Setting.send(setting), options).html_safe
|
||||
end
|
||||
|
||||
def setting_check_box(setting, options={})
|
||||
setting_label(setting, options) +
|
||||
hidden_field_tag("settings[#{setting}]", 0) +
|
||||
check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), options)
|
||||
setting_label(setting, options).html_safe +
|
||||
hidden_field_tag("settings[#{setting}]", 0).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}")) : ''
|
||||
label != false ? content_tag("label", l(label || "setting_#{setting}")).html_safe : ''
|
||||
end
|
||||
|
||||
# Renders a notification field for a Redmine::Notifiable option
|
||||
|
@ -84,8 +84,8 @@ module SettingsHelper
|
|||
return content_tag(:label,
|
||||
check_box_tag('settings[notified_events][]',
|
||||
notifiable.name,
|
||||
Setting.notified_events.include?(notifiable.name)) +
|
||||
l_or_humanize(notifiable.name, :prefix => 'label_'),
|
||||
:class => notifiable.parent.present? ? "parent" : '')
|
||||
Setting.notified_events.include?(notifiable.name)).html_safe +
|
||||
l_or_humanize(notifiable.name, :prefix => 'label_').html_safe,
|
||||
:class => notifiable.parent.present? ? "parent" : '').html_safe
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue