@@ -0,0 +1,15 | |||||
|
1 | <%= form_tag({:action => 'edit', :tab => 'attachments'}) do %> | |||
|
2 | ||||
|
3 | <div class="box tabular settings"> | |||
|
4 | <p><%= setting_text_field :attachment_max_size, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %></p> | |||
|
5 | ||||
|
6 | <p><%= setting_text_field :file_max_size_displayed, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %></p> | |||
|
7 | ||||
|
8 | <p><%= setting_text_field :diff_max_lines_displayed, :size => 6 %></p> | |||
|
9 | ||||
|
10 | <p><%= setting_text_field :repositories_encodings, :size => 60 %> | |||
|
11 | <em class="info"><%= l(:text_comma_separated) %></em></p> | |||
|
12 | </div> | |||
|
13 | ||||
|
14 | <%= submit_tag l(:button_save) %> | |||
|
15 | <% end %> |
@@ -1,172 +1,173 | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 | # |
|
2 | # | |
3 | # Redmine - project management software |
|
3 | # Redmine - project management software | |
4 | # Copyright (C) 2006-2015 Jean-Philippe Lang |
|
4 | # Copyright (C) 2006-2015 Jean-Philippe Lang | |
5 | # |
|
5 | # | |
6 | # This program is free software; you can redistribute it and/or |
|
6 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
7 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; either version 2 |
|
8 | # as published by the Free Software Foundation; either version 2 | |
9 | # of the License, or (at your option) any later version. |
|
9 | # of the License, or (at your option) any later version. | |
10 | # |
|
10 | # | |
11 | # This program is distributed in the hope that it will be useful, |
|
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. |
|
14 | # GNU General Public License for more details. | |
15 | # |
|
15 | # | |
16 | # You should have received a copy of the GNU General Public License |
|
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software |
|
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 |
|
19 | |||
20 | module SettingsHelper |
|
20 | module SettingsHelper | |
21 | def administration_settings_tabs |
|
21 | def administration_settings_tabs | |
22 | tabs = [{:name => 'general', :partial => 'settings/general', :label => :label_general}, |
|
22 | tabs = [{:name => 'general', :partial => 'settings/general', :label => :label_general}, | |
23 | {:name => 'display', :partial => 'settings/display', :label => :label_display}, |
|
23 | {:name => 'display', :partial => 'settings/display', :label => :label_display}, | |
24 | {:name => 'authentication', :partial => 'settings/authentication', :label => :label_authentication}, |
|
24 | {:name => 'authentication', :partial => 'settings/authentication', :label => :label_authentication}, | |
25 | {:name => 'api', :partial => 'settings/api', :label => :label_api}, |
|
25 | {:name => 'api', :partial => 'settings/api', :label => :label_api}, | |
26 | {:name => 'projects', :partial => 'settings/projects', :label => :label_project_plural}, |
|
26 | {:name => 'projects', :partial => 'settings/projects', :label => :label_project_plural}, | |
27 | {:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking}, |
|
27 | {:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking}, | |
|
28 | {:name => 'attachments', :partial => 'settings/attachments', :label => :label_attachment_plural}, | |||
28 | {:name => 'notifications', :partial => 'settings/notifications', :label => :field_mail_notification}, |
|
29 | {:name => 'notifications', :partial => 'settings/notifications', :label => :field_mail_notification}, | |
29 | {:name => 'mail_handler', :partial => 'settings/mail_handler', :label => :label_incoming_emails}, |
|
30 | {:name => 'mail_handler', :partial => 'settings/mail_handler', :label => :label_incoming_emails}, | |
30 | {:name => 'repositories', :partial => 'settings/repositories', :label => :label_repository_plural} |
|
31 | {:name => 'repositories', :partial => 'settings/repositories', :label => :label_repository_plural} | |
31 | ] |
|
32 | ] | |
32 | end |
|
33 | end | |
33 |
|
34 | |||
34 | def setting_select(setting, choices, options={}) |
|
35 | def setting_select(setting, choices, options={}) | |
35 | if blank_text = options.delete(:blank) |
|
36 | if blank_text = options.delete(:blank) | |
36 | choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices |
|
37 | choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices | |
37 | end |
|
38 | end | |
38 | setting_label(setting, options).html_safe + |
|
39 | setting_label(setting, options).html_safe + | |
39 | select_tag("settings[#{setting}]", |
|
40 | select_tag("settings[#{setting}]", | |
40 | options_for_select(choices, Setting.send(setting).to_s), |
|
41 | options_for_select(choices, Setting.send(setting).to_s), | |
41 | options).html_safe |
|
42 | options).html_safe | |
42 | end |
|
43 | end | |
43 |
|
44 | |||
44 | def setting_multiselect(setting, choices, options={}) |
|
45 | def setting_multiselect(setting, choices, options={}) | |
45 | setting_values = Setting.send(setting) |
|
46 | setting_values = Setting.send(setting) | |
46 | setting_values = [] unless setting_values.is_a?(Array) |
|
47 | setting_values = [] unless setting_values.is_a?(Array) | |
47 |
|
48 | |||
48 | content_tag("label", l(options[:label] || "setting_#{setting}")) + |
|
49 | content_tag("label", l(options[:label] || "setting_#{setting}")) + | |
49 | hidden_field_tag("settings[#{setting}][]", '').html_safe + |
|
50 | hidden_field_tag("settings[#{setting}][]", '').html_safe + | |
50 | choices.collect do |choice| |
|
51 | choices.collect do |choice| | |
51 | text, value = (choice.is_a?(Array) ? choice : [choice, choice]) |
|
52 | text, value = (choice.is_a?(Array) ? choice : [choice, choice]) | |
52 | content_tag( |
|
53 | content_tag( | |
53 | 'label', |
|
54 | 'label', | |
54 | check_box_tag( |
|
55 | check_box_tag( | |
55 | "settings[#{setting}][]", |
|
56 | "settings[#{setting}][]", | |
56 | value, |
|
57 | value, | |
57 | setting_values.include?(value), |
|
58 | setting_values.include?(value), | |
58 | :id => nil |
|
59 | :id => nil | |
59 | ) + text.to_s, |
|
60 | ) + text.to_s, | |
60 | :class => (options[:inline] ? 'inline' : 'block') |
|
61 | :class => (options[:inline] ? 'inline' : 'block') | |
61 | ) |
|
62 | ) | |
62 | end.join.html_safe |
|
63 | end.join.html_safe | |
63 | end |
|
64 | end | |
64 |
|
65 | |||
65 | def setting_text_field(setting, options={}) |
|
66 | def setting_text_field(setting, options={}) | |
66 | setting_label(setting, options).html_safe + |
|
67 | setting_label(setting, options).html_safe + | |
67 | text_field_tag("settings[#{setting}]", Setting.send(setting), options).html_safe |
|
68 | text_field_tag("settings[#{setting}]", Setting.send(setting), options).html_safe | |
68 | end |
|
69 | end | |
69 |
|
70 | |||
70 | def setting_text_area(setting, options={}) |
|
71 | def setting_text_area(setting, options={}) | |
71 | setting_label(setting, options).html_safe + |
|
72 | setting_label(setting, options).html_safe + | |
72 | text_area_tag("settings[#{setting}]", Setting.send(setting), options).html_safe |
|
73 | text_area_tag("settings[#{setting}]", Setting.send(setting), options).html_safe | |
73 | end |
|
74 | end | |
74 |
|
75 | |||
75 | def setting_check_box(setting, options={}) |
|
76 | def setting_check_box(setting, options={}) | |
76 | setting_label(setting, options).html_safe + |
|
77 | setting_label(setting, options).html_safe + | |
77 | hidden_field_tag("settings[#{setting}]", 0, :id => nil).html_safe + |
|
78 | hidden_field_tag("settings[#{setting}]", 0, :id => nil).html_safe + | |
78 | check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), options).html_safe |
|
79 | check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), options).html_safe | |
79 | end |
|
80 | end | |
80 |
|
81 | |||
81 | def setting_label(setting, options={}) |
|
82 | def setting_label(setting, options={}) | |
82 | label = options.delete(:label) |
|
83 | label = options.delete(:label) | |
83 | if label == false |
|
84 | if label == false | |
84 | '' |
|
85 | '' | |
85 | else |
|
86 | else | |
86 | text = label.is_a?(String) ? label : l(label || "setting_#{setting}") |
|
87 | text = label.is_a?(String) ? label : l(label || "setting_#{setting}") | |
87 | label_tag("settings_#{setting}", text, options[:label_options]) |
|
88 | label_tag("settings_#{setting}", text, options[:label_options]) | |
88 | end |
|
89 | end | |
89 | end |
|
90 | end | |
90 |
|
91 | |||
91 | # Renders a notification field for a Redmine::Notifiable option |
|
92 | # Renders a notification field for a Redmine::Notifiable option | |
92 | def notification_field(notifiable) |
|
93 | def notification_field(notifiable) | |
93 | tag_data = notifiable.parent.present? ? |
|
94 | tag_data = notifiable.parent.present? ? | |
94 | {:parent_notifiable => notifiable.parent} : |
|
95 | {:parent_notifiable => notifiable.parent} : | |
95 | {:disables => "input[data-parent-notifiable=#{notifiable.name}]"} |
|
96 | {:disables => "input[data-parent-notifiable=#{notifiable.name}]"} | |
96 |
|
97 | |||
97 | tag = check_box_tag('settings[notified_events][]', |
|
98 | tag = check_box_tag('settings[notified_events][]', | |
98 | notifiable.name, |
|
99 | notifiable.name, | |
99 | Setting.notified_events.include?(notifiable.name), |
|
100 | Setting.notified_events.include?(notifiable.name), | |
100 | :id => nil, |
|
101 | :id => nil, | |
101 | :data => tag_data) |
|
102 | :data => tag_data) | |
102 |
|
103 | |||
103 | text = l_or_humanize(notifiable.name, :prefix => 'label_') |
|
104 | text = l_or_humanize(notifiable.name, :prefix => 'label_') | |
104 |
|
105 | |||
105 | options = {} |
|
106 | options = {} | |
106 | if notifiable.parent.present? |
|
107 | if notifiable.parent.present? | |
107 | options[:class] = "parent" |
|
108 | options[:class] = "parent" | |
108 | end |
|
109 | end | |
109 |
|
110 | |||
110 | content_tag(:label, tag + text, options) |
|
111 | content_tag(:label, tag + text, options) | |
111 | end |
|
112 | end | |
112 |
|
113 | |||
113 | def link_copied_issue_options |
|
114 | def link_copied_issue_options | |
114 | options = [ |
|
115 | options = [ | |
115 | [:general_text_Yes, 'yes'], |
|
116 | [:general_text_Yes, 'yes'], | |
116 | [:general_text_No, 'no'], |
|
117 | [:general_text_No, 'no'], | |
117 | [:label_ask, 'ask'] |
|
118 | [:label_ask, 'ask'] | |
118 | ] |
|
119 | ] | |
119 |
|
120 | |||
120 | options.map {|label, value| [l(label), value.to_s]} |
|
121 | options.map {|label, value| [l(label), value.to_s]} | |
121 | end |
|
122 | end | |
122 |
|
123 | |||
123 | def cross_project_subtasks_options |
|
124 | def cross_project_subtasks_options | |
124 | options = [ |
|
125 | options = [ | |
125 | [:label_disabled, ''], |
|
126 | [:label_disabled, ''], | |
126 | [:label_cross_project_system, 'system'], |
|
127 | [:label_cross_project_system, 'system'], | |
127 | [:label_cross_project_tree, 'tree'], |
|
128 | [:label_cross_project_tree, 'tree'], | |
128 | [:label_cross_project_hierarchy, 'hierarchy'], |
|
129 | [:label_cross_project_hierarchy, 'hierarchy'], | |
129 | [:label_cross_project_descendants, 'descendants'] |
|
130 | [:label_cross_project_descendants, 'descendants'] | |
130 | ] |
|
131 | ] | |
131 |
|
132 | |||
132 | options.map {|label, value| [l(label), value.to_s]} |
|
133 | options.map {|label, value| [l(label), value.to_s]} | |
133 | end |
|
134 | end | |
134 |
|
135 | |||
135 | def parent_issue_dates_options |
|
136 | def parent_issue_dates_options | |
136 | options = [ |
|
137 | options = [ | |
137 | [:label_parent_task_attributes_derived, 'derived'], |
|
138 | [:label_parent_task_attributes_derived, 'derived'], | |
138 | [:label_parent_task_attributes_independent, 'independent'] |
|
139 | [:label_parent_task_attributes_independent, 'independent'] | |
139 | ] |
|
140 | ] | |
140 |
|
141 | |||
141 | options.map {|label, value| [l(label), value.to_s]} |
|
142 | options.map {|label, value| [l(label), value.to_s]} | |
142 | end |
|
143 | end | |
143 |
|
144 | |||
144 | def parent_issue_priority_options |
|
145 | def parent_issue_priority_options | |
145 | options = [ |
|
146 | options = [ | |
146 | [:label_parent_task_attributes_derived, 'derived'], |
|
147 | [:label_parent_task_attributes_derived, 'derived'], | |
147 | [:label_parent_task_attributes_independent, 'independent'] |
|
148 | [:label_parent_task_attributes_independent, 'independent'] | |
148 | ] |
|
149 | ] | |
149 |
|
150 | |||
150 | options.map {|label, value| [l(label), value.to_s]} |
|
151 | options.map {|label, value| [l(label), value.to_s]} | |
151 | end |
|
152 | end | |
152 |
|
153 | |||
153 | def parent_issue_done_ratio_options |
|
154 | def parent_issue_done_ratio_options | |
154 | options = [ |
|
155 | options = [ | |
155 | [:label_parent_task_attributes_derived, 'derived'], |
|
156 | [:label_parent_task_attributes_derived, 'derived'], | |
156 | [:label_parent_task_attributes_independent, 'independent'] |
|
157 | [:label_parent_task_attributes_independent, 'independent'] | |
157 | ] |
|
158 | ] | |
158 |
|
159 | |||
159 | options.map {|label, value| [l(label), value.to_s]} |
|
160 | options.map {|label, value| [l(label), value.to_s]} | |
160 | end |
|
161 | end | |
161 |
|
162 | |||
162 | # Returns the options for the date_format setting |
|
163 | # Returns the options for the date_format setting | |
163 | def date_format_setting_options(locale) |
|
164 | def date_format_setting_options(locale) | |
164 | Setting::DATE_FORMATS.map do |f| |
|
165 | Setting::DATE_FORMATS.map do |f| | |
165 | today = ::I18n.l(Date.today, :locale => locale, :format => f) |
|
166 | today = ::I18n.l(Date.today, :locale => locale, :format => f) | |
166 | format = f.gsub('%', '').gsub(/[dmY]/) do |
|
167 | format = f.gsub('%', '').gsub(/[dmY]/) do | |
167 | {'d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy'}[$&] |
|
168 | {'d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy'}[$&] | |
168 | end |
|
169 | end | |
169 | ["#{today} (#{format})", f] |
|
170 | ["#{today} (#{format})", f] | |
170 | end |
|
171 | end | |
171 | end |
|
172 | end | |
172 | end |
|
173 | end |
@@ -1,42 +1,34 | |||||
1 | <%= form_tag({:action => 'edit'}) do %> |
|
1 | <%= form_tag({:action => 'edit'}) do %> | |
2 |
|
2 | |||
3 | <div class="box tabular settings"> |
|
3 | <div class="box tabular settings"> | |
4 | <p><%= setting_text_field :app_title, :size => 30 %></p> |
|
4 | <p><%= setting_text_field :app_title, :size => 30 %></p> | |
5 |
|
5 | |||
6 | <p><%= setting_text_area :welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p> |
|
6 | <p><%= setting_text_area :welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p> | |
7 | <%= wikitoolbar_for 'settings_welcome_text' %> |
|
7 | <%= wikitoolbar_for 'settings_welcome_text' %> | |
8 |
|
8 | |||
9 | <p><%= setting_text_field :attachment_max_size, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %></p> |
|
|||
10 |
|
9 | |||
11 | <p><%= setting_text_field :per_page_options, :size => 20 %> |
|
10 | <p><%= setting_text_field :per_page_options, :size => 20 %> | |
12 | <em class="info"><%= l(:text_comma_separated) %></em></p> |
|
11 | <em class="info"><%= l(:text_comma_separated) %></em></p> | |
13 |
|
12 | |||
14 | <p><%= setting_text_field :search_results_per_page, :size => 6 %> |
|
13 | <p><%= setting_text_field :search_results_per_page, :size => 6 %> | |
15 |
|
14 | |||
16 | <p><%= setting_text_field :activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p> |
|
15 | <p><%= setting_text_field :activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p> | |
17 |
|
16 | |||
18 | <p><%= setting_text_field :host_name, :size => 60 %> |
|
17 | <p><%= setting_text_field :host_name, :size => 60 %> | |
19 | <em class="info"><%= l(:label_example) %>: <%= @guessed_host_and_path %></em></p> |
|
18 | <em class="info"><%= l(:label_example) %>: <%= @guessed_host_and_path %></em></p> | |
20 |
|
19 | |||
21 | <p><%= setting_select :protocol, [['HTTP', 'http'], ['HTTPS', 'https']] %></p> |
|
20 | <p><%= setting_select :protocol, [['HTTP', 'http'], ['HTTPS', 'https']] %></p> | |
22 |
|
21 | |||
23 | <p><%= setting_select :text_formatting, Redmine::WikiFormatting.formats_for_select, :blank => :label_none %></p> |
|
22 | <p><%= setting_select :text_formatting, Redmine::WikiFormatting.formats_for_select, :blank => :label_none %></p> | |
24 |
|
23 | |||
25 | <p><%= setting_check_box :cache_formatted_text %></p> |
|
24 | <p><%= setting_check_box :cache_formatted_text %></p> | |
26 |
|
25 | |||
27 | <p><%= setting_select :wiki_compression, [['Gzip', 'gzip']], :blank => :label_none %></p> |
|
26 | <p><%= setting_select :wiki_compression, [['Gzip', 'gzip']], :blank => :label_none %></p> | |
28 |
|
27 | |||
29 | <p><%= setting_text_field :feeds_limit, :size => 6 %></p> |
|
28 | <p><%= setting_text_field :feeds_limit, :size => 6 %></p> | |
30 |
|
29 | |||
31 | <p><%= setting_text_field :file_max_size_displayed, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %></p> |
|
|||
32 |
|
||||
33 | <p><%= setting_text_field :diff_max_lines_displayed, :size => 6 %></p> |
|
|||
34 |
|
||||
35 | <p><%= setting_text_field :repositories_encodings, :size => 60 %> |
|
|||
36 | <em class="info"><%= l(:text_comma_separated) %></em></p> |
|
|||
37 |
|
||||
38 | <%= call_hook(:view_settings_general_form) %> |
|
30 | <%= call_hook(:view_settings_general_form) %> | |
39 | </div> |
|
31 | </div> | |
40 |
|
32 | |||
41 | <%= submit_tag l(:button_save) %> |
|
33 | <%= submit_tag l(:button_save) %> | |
42 | <% end %> |
|
34 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now