##// END OF EJS Templates
Removed duplicate ids....
Jean-Philippe Lang -
r9942:1e6938a1197b
parent child
Show More
@@ -1,93 +1,94
1 1 # encoding: utf-8
2 2 #
3 3 # Redmine - project management software
4 4 # Copyright (C) 2006-2012 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 => 'projects', :partial => 'settings/projects', :label => :label_project_plural},
26 26 {:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking},
27 27 {:name => 'notifications', :partial => 'settings/notifications', :label => :field_mail_notification},
28 28 {:name => 'mail_handler', :partial => 'settings/mail_handler', :label => :label_incoming_emails},
29 29 {:name => 'repositories', :partial => 'settings/repositories', :label => :label_repository_plural}
30 30 ]
31 31 end
32 32
33 33 def setting_select(setting, choices, options={})
34 34 if blank_text = options.delete(:blank)
35 35 choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices
36 36 end
37 37 setting_label(setting, options).html_safe +
38 38 select_tag("settings[#{setting}]",
39 39 options_for_select(choices, Setting.send(setting).to_s),
40 40 options).html_safe
41 41 end
42 42
43 43 def setting_multiselect(setting, choices, options={})
44 44 setting_values = Setting.send(setting)
45 45 setting_values = [] unless setting_values.is_a?(Array)
46 46
47 47 setting_label(setting, options).html_safe +
48 48 hidden_field_tag("settings[#{setting}][]", '').html_safe +
49 49 choices.collect do |choice|
50 50 text, value = (choice.is_a?(Array) ? choice : [choice, choice])
51 51 content_tag(
52 52 'label',
53 53 check_box_tag(
54 54 "settings[#{setting}][]",
55 55 value,
56 Setting.send(setting).include?(value)
56 Setting.send(setting).include?(value),
57 :id => nil
57 58 ) + text.to_s,
58 59 :class => 'block'
59 60 )
60 61 end.join.html_safe
61 62 end
62 63
63 64 def setting_text_field(setting, options={})
64 65 setting_label(setting, options).html_safe +
65 66 text_field_tag("settings[#{setting}]", Setting.send(setting), options).html_safe
66 67 end
67 68
68 69 def setting_text_area(setting, options={})
69 70 setting_label(setting, options).html_safe +
70 71 text_area_tag("settings[#{setting}]", Setting.send(setting), options).html_safe
71 72 end
72 73
73 74 def setting_check_box(setting, options={})
74 75 setting_label(setting, options).html_safe +
75 hidden_field_tag("settings[#{setting}]", 0).html_safe +
76 hidden_field_tag("settings[#{setting}]", 0, :id => nil).html_safe +
76 77 check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), options).html_safe
77 78 end
78 79
79 80 def setting_label(setting, options={})
80 81 label = options.delete(:label)
81 82 label != false ? content_tag("label", l(label || "setting_#{setting}")).html_safe : ''
82 83 end
83 84
84 85 # Renders a notification field for a Redmine::Notifiable option
85 86 def notification_field(notifiable)
86 87 return content_tag(:label,
87 88 check_box_tag('settings[notified_events][]',
88 89 notifiable.name,
89 Setting.notified_events.include?(notifiable.name)).html_safe +
90 Setting.notified_events.include?(notifiable.name), :id => nil).html_safe +
90 91 l_or_humanize(notifiable.name, :prefix => 'label_').html_safe,
91 92 :class => notifiable.parent.present? ? "parent" : '').html_safe
92 93 end
93 94 end
@@ -1,97 +1,92
1 1 <%= form_tag({:action => 'edit', :tab => 'repositories'}) do %>
2 2
3 3 <fieldset class="box settings enabled_scm">
4 4 <%= hidden_field_tag 'settings[enabled_scm][]', '' %>
5 5 <legend><%= l(:setting_enabled_scm) %></legend>
6 6 <table>
7 7 <tr>
8 8 <th></th>
9 9 <th><%= l(:text_scm_command) %></th>
10 10 <th><%= l(:text_scm_command_version) %></th>
11 11 </tr>
12 12 <% Redmine::Scm::Base.all.collect do |choice| %>
13 13 <% scm_class = "Repository::#{choice}".constantize %>
14 14 <% text, value = (choice.is_a?(Array) ? choice : [choice, choice]) %>
15 15 <% setting = :enabled_scm %>
16 16 <% enabled = Setting.send(setting).include?(value) %>
17 17 <tr>
18 18 <td class="scm_name">
19 <%=
20 check_box_tag(
21 "settings[#{setting}][]",
22 value,
23 enabled)
24 %>
19 <%= check_box_tag("settings[#{setting}][]", value, enabled, :id => nil) %>
25 20 <%= text.to_s %>
26 21 </td>
27 22 <td>
28 23 <% if enabled %>
29 24 <%=
30 25 image_tag(
31 26 (scm_class.scm_available ? 'true.png' : 'exclamation.png'),
32 27 :style => "vertical-align:bottom;"
33 28 )
34 29 %>
35 30 <%= scm_class.scm_command %>
36 31 <% end %>
37 32 </td>
38 33 <td>
39 34 <%= scm_class.scm_version_string if enabled %>
40 35 </td>
41 36 </tr>
42 37 <% end %>
43 38 </table>
44 39 <p><em class="info"><%= l(:text_scm_config) %></em></p>
45 40 </fieldset>
46 41
47 42 <div class="box tabular settings">
48 43 <p><%= setting_check_box :autofetch_changesets %></p>
49 44
50 45 <p><%= setting_check_box :sys_api_enabled,
51 46 :onclick =>
52 47 "if (this.checked) { $('#settings_sys_api_key').removeAttr('disabled'); } else { $('#settings_sys_api_key').attr('disabled', true); }" %></p>
53 48
54 49 <p><%= setting_text_field :sys_api_key,
55 50 :size => 30,
56 51 :id => 'settings_sys_api_key',
57 52 :disabled => !Setting.sys_api_enabled?,
58 53 :label => :setting_mail_handler_api_key %>
59 54 <%= link_to_function l(:label_generate_key),
60 55 "if (!$('#settings_sys_api_key').attr('disabled')) { $('#settings_sys_api_key').val(randomKey(20)) }" %>
61 56 </p>
62 57
63 58 <p><%= setting_text_field :repository_log_display_limit, :size => 6 %></p>
64 59 </div>
65 60
66 61 <fieldset class="box tabular settings">
67 62 <legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
68 63 <p><%= setting_text_field :commit_ref_keywords, :size => 30 %>
69 64 <em class="info"><%= l(:text_comma_separated) %></em></p>
70 65
71 66 <p><%= setting_text_field :commit_fix_keywords, :size => 30 %>
72 67 &nbsp;<%= l(:label_applied_status) %>: <%= setting_select :commit_fix_status_id,
73 68 [["", 0]] +
74 69 IssueStatus.find(:all).collect{
75 70 |status| [status.name, status.id.to_s]
76 71 },
77 72 :label => false %>
78 73 &nbsp;<%= l(:field_done_ratio) %>: <%= setting_select :commit_fix_done_ratio,
79 74 (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] },
80 75 :blank => :label_no_change_option,
81 76 :label => false %>
82 77 <em class="info"><%= l(:text_comma_separated) %></em></p>
83 78
84 79 <p><%= setting_check_box :commit_cross_project_ref %></p>
85 80
86 81 <p><%= setting_check_box :commit_logtime_enabled,
87 82 :onclick =>
88 83 "if (this.checked) { $('#settings_commit_logtime_activity_id').removeAttr('disabled'); } else { $('#settings_commit_logtime_activity_id').attr('disabled', true); }"%></p>
89 84
90 85 <p><%= setting_select :commit_logtime_activity_id,
91 86 [[l(:label_default), 0]] +
92 87 TimeEntryActivity.shared.active.collect{|activity| [activity.name, activity.id.to_s]},
93 88 :disabled => !Setting.commit_logtime_enabled?%></p>
94 89 </fieldset>
95 90
96 91 <%= submit_tag l(:button_save) %>
97 92 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now