##// END OF EJS Templates
Merged r8568 from trunk (#9937)....
Jean-Philippe Lang -
r8649:6d66abe3acf2
parent child
Show More
@@ -1,91 +1,92
1 1 <% form_tag({:action => 'edit', :tab => 'repositories'}) do %>
2 2
3 3 <fieldset class="box settings enabled_scm">
4 <%= hidden_field_tag 'settings[enabled_scm][]', '' %>
4 5 <legend><%= l(:setting_enabled_scm) %></legend>
5 6 <table>
6 7 <tr>
7 8 <th></th>
8 9 <th><%= l(:text_scm_command) %></th>
9 10 <th><%= l(:text_scm_command_version) %></th>
10 11 </tr>
11 12 <% Redmine::Scm::Base.all.collect do |choice| %>
12 13 <% scm_class = "Repository::#{choice}".constantize %>
13 14 <% text, value = (choice.is_a?(Array) ? choice : [choice, choice]) %>
14 15 <% setting = :enabled_scm %>
15 16 <tr>
16 17 <td class="scm_name">
17 18 <%=
18 19 check_box_tag(
19 20 "settings[#{setting}][]",
20 21 value,
21 22 Setting.send(setting).include?(value))
22 23 %>
23 24 <%= text.to_s %>
24 25 </td>
25 26 <td>
26 27 <%=
27 28 image_tag(
28 29 (scm_class.scm_available ? 'true.png' : 'exclamation.png'),
29 30 :style => "vertical-align:bottom;"
30 31 )
31 32 %>
32 33 <%= scm_class.scm_command %>
33 34 </td>
34 35 <td>
35 36 <%= scm_class.scm_version_string %>
36 37 </td>
37 38 </tr>
38 39 <% end %>
39 40 </table>
40 41 <p><em><%= l(:text_scm_config) %></em></p>
41 42 </fieldset>
42 43
43 44 <div class="box tabular settings">
44 45 <p><%= setting_check_box :autofetch_changesets %></p>
45 46
46 47 <p><%= setting_check_box :sys_api_enabled,
47 48 :onclick =>
48 49 "if (this.checked) { Form.Element.enable('settings_sys_api_key'); } else { Form.Element.disable('settings_sys_api_key'); }" %></p>
49 50
50 51 <p><%= setting_text_field :sys_api_key,
51 52 :size => 30,
52 53 :id => 'settings_sys_api_key',
53 54 :disabled => !Setting.sys_api_enabled?,
54 55 :label => :setting_mail_handler_api_key %>
55 56 <%= link_to_function l(:label_generate_key),
56 57 "if ($('settings_sys_api_key').disabled == false) { $('settings_sys_api_key').value = randomKey(20) }" %>
57 58 </p>
58 59
59 60 <p><%= setting_text_field :repository_log_display_limit, :size => 6 %></p>
60 61 </div>
61 62
62 63 <fieldset class="box tabular settings">
63 64 <legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
64 65 <p><%= setting_text_field :commit_ref_keywords, :size => 30 %><br />
65 66 <em><%= l(:text_comma_separated) %></em></p>
66 67
67 68 <p><%= setting_text_field :commit_fix_keywords, :size => 30 %>
68 69 &nbsp;<%= l(:label_applied_status) %>: <%= setting_select :commit_fix_status_id,
69 70 [["", 0]] +
70 71 IssueStatus.find(:all).collect{
71 72 |status| [status.name, status.id.to_s]
72 73 },
73 74 :label => false %>
74 75 &nbsp;<%= l(:field_done_ratio) %>: <%= setting_select :commit_fix_done_ratio,
75 76 (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] },
76 77 :blank => :label_no_change_option,
77 78 :label => false %>
78 79 <br /><em><%= l(:text_comma_separated) %></em></p>
79 80
80 81 <p><%= setting_check_box :commit_logtime_enabled,
81 82 :onclick =>
82 83 "if (this.checked) { Form.Element.enable('settings_commit_logtime_activity_id'); } else { Form.Element.disable('settings_commit_logtime_activity_id'); }"%></p>
83 84
84 85 <p><%= setting_select :commit_logtime_activity_id,
85 86 [[l(:label_default), 0]] +
86 87 TimeEntryActivity.shared.active.collect{|activity| [activity.name, activity.id.to_s]},
87 88 :disabled => !Setting.commit_logtime_enabled?%></p>
88 89 </fieldset>
89 90
90 91 <%= submit_tag l(:button_save) %>
91 92 <% end %>
@@ -1,59 +1,61
1 1 # Redmine - project management software
2 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.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19 require 'settings_controller'
20 20
21 21 # Re-raise errors caught by the controller.
22 22 class SettingsController; def rescue_action(e) raise e end; end
23 23
24 24 class SettingsControllerTest < ActionController::TestCase
25 25 fixtures :users
26 26
27 27 def setup
28 28 @controller = SettingsController.new
29 29 @request = ActionController::TestRequest.new
30 30 @response = ActionController::TestResponse.new
31 31 User.current = nil
32 32 @request.session[:user_id] = 1 # admin
33 33 end
34 34
35 35 def test_index
36 36 get :index
37 37 assert_response :success
38 38 assert_template 'edit'
39 39 end
40 40
41 41 def test_get_edit
42 42 get :edit
43 43 assert_response :success
44 44 assert_template 'edit'
45
46 assert_tag 'input', :attributes => {:name => 'settings[enabled_scm][]', :value => ''}
45 47 end
46 48
47 49 def test_post_edit_notifications
48 50 post :edit, :settings => {:mail_from => 'functional@test.foo',
49 51 :bcc_recipients => '0',
50 52 :notified_events => %w(issue_added issue_updated news_added),
51 53 :emails_footer => 'Test footer'
52 54 }
53 55 assert_redirected_to '/settings/edit'
54 56 assert_equal 'functional@test.foo', Setting.mail_from
55 57 assert !Setting.bcc_recipients?
56 58 assert_equal %w(issue_added issue_updated news_added), Setting.notified_events
57 59 assert_equal 'Test footer', Setting.emails_footer
58 60 end
59 61 end
General Comments 0
You need to be logged in to leave comments. Login now