@@ -1,16 +1,16 | |||
|
1 | 1 | # Redmine - project management software |
|
2 |
# Copyright (C) 2006-20 |
|
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -27,7 +27,7 module SettingsHelper | |||
|
27 | 27 | {:name => 'repositories', :partial => 'settings/repositories', :label => :label_repository_plural} |
|
28 | 28 | ] |
|
29 | 29 | end |
|
30 | ||
|
30 | ||
|
31 | 31 | def setting_select(setting, choices, options={}) |
|
32 | 32 | if blank_text = options.delete(:blank) |
|
33 | 33 | choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices |
@@ -35,38 +35,38 module SettingsHelper | |||
|
35 | 35 | setting_label(setting, options) + |
|
36 | 36 | select_tag("settings[#{setting}]", options_for_select(choices, Setting.send(setting).to_s), options) |
|
37 | 37 | end |
|
38 | ||
|
38 | ||
|
39 | 39 | def setting_multiselect(setting, choices, options={}) |
|
40 | 40 | setting_values = Setting.send(setting) |
|
41 | 41 | setting_values = [] unless setting_values.is_a?(Array) |
|
42 | ||
|
42 | ||
|
43 | 43 | setting_label(setting, options) + |
|
44 | 44 | hidden_field_tag("settings[#{setting}][]", '') + |
|
45 | 45 | choices.collect do |choice| |
|
46 |
text, value = (choice.is_a?(Array) ? choice : [choice, choice]) |
|
|
46 | text, value = (choice.is_a?(Array) ? choice : [choice, choice]) | |
|
47 | 47 | content_tag('label', |
|
48 | 48 | check_box_tag("settings[#{setting}][]", value, Setting.send(setting).include?(value)) + text.to_s, |
|
49 | 49 | :class => 'block' |
|
50 | 50 | ) |
|
51 | 51 | end.join |
|
52 | 52 | end |
|
53 | ||
|
53 | ||
|
54 | 54 | def setting_text_field(setting, options={}) |
|
55 | 55 | setting_label(setting, options) + |
|
56 | 56 | text_field_tag("settings[#{setting}]", Setting.send(setting), options) |
|
57 | 57 | end |
|
58 | ||
|
58 | ||
|
59 | 59 | def setting_text_area(setting, options={}) |
|
60 | 60 | setting_label(setting, options) + |
|
61 | 61 | text_area_tag("settings[#{setting}]", Setting.send(setting), options) |
|
62 | 62 | end |
|
63 | ||
|
63 | ||
|
64 | 64 | def setting_check_box(setting, options={}) |
|
65 | 65 | setting_label(setting, options) + |
|
66 | 66 | hidden_field_tag("settings[#{setting}]", 0) + |
|
67 | 67 | check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), options) |
|
68 | 68 | end |
|
69 | ||
|
69 | ||
|
70 | 70 | def setting_label(setting, options={}) |
|
71 | 71 | label = options.delete(:label) |
|
72 | 72 | label != false ? content_tag("label", l(label || "setting_#{setting}")) : '' |
General Comments 0
You need to be logged in to leave comments.
Login now