##// END OF EJS Templates
code clean up settings helper....
Toshi MARUYAMA -
r5830:45d05bd2d9af
parent child
Show More
@@ -33,7 +33,9 module SettingsHelper
33 choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices
33 choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices
34 end
34 end
35 setting_label(setting, options) +
35 setting_label(setting, options) +
36 select_tag("settings[#{setting}]", options_for_select(choices, Setting.send(setting).to_s), options)
36 select_tag("settings[#{setting}]",
37 options_for_select(choices, Setting.send(setting).to_s),
38 options)
37 end
39 end
38
40
39 def setting_multiselect(setting, choices, options={})
41 def setting_multiselect(setting, choices, options={})
@@ -44,8 +46,13 module SettingsHelper
44 hidden_field_tag("settings[#{setting}][]", '') +
46 hidden_field_tag("settings[#{setting}][]", '') +
45 choices.collect do |choice|
47 choices.collect do |choice|
46 text, value = (choice.is_a?(Array) ? choice : [choice, choice])
48 text, value = (choice.is_a?(Array) ? choice : [choice, choice])
47 content_tag('label',
49 content_tag(
48 check_box_tag("settings[#{setting}][]", value, Setting.send(setting).include?(value)) + text.to_s,
50 'label',
51 check_box_tag(
52 "settings[#{setting}][]",
53 value,
54 Setting.send(setting).include?(value)
55 ) + text.to_s,
49 :class => 'block'
56 :class => 'block'
50 )
57 )
51 end.join
58 end.join
General Comments 0
You need to be logged in to leave comments. Login now