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