@@ -1,91 +1,92 | |||||
1 | <% form_tag({:action => 'edit', :tab => 'repositories'}) do %> |
|
1 | <% form_tag({:action => 'edit', :tab => 'repositories'}) do %> | |
2 |
|
2 | |||
3 | <fieldset class="box settings enabled_scm"> |
|
3 | <fieldset class="box settings enabled_scm"> | |
|
4 | <%= hidden_field_tag 'settings[enabled_scm][]', '' %> | |||
4 | <legend><%= l(:setting_enabled_scm) %></legend> |
|
5 | <legend><%= l(:setting_enabled_scm) %></legend> | |
5 | <table> |
|
6 | <table> | |
6 | <tr> |
|
7 | <tr> | |
7 | <th></th> |
|
8 | <th></th> | |
8 | <th><%= l(:text_scm_command) %></th> |
|
9 | <th><%= l(:text_scm_command) %></th> | |
9 | <th><%= l(:text_scm_command_version) %></th> |
|
10 | <th><%= l(:text_scm_command_version) %></th> | |
10 | </tr> |
|
11 | </tr> | |
11 | <% Redmine::Scm::Base.all.collect do |choice| %> |
|
12 | <% Redmine::Scm::Base.all.collect do |choice| %> | |
12 | <% scm_class = "Repository::#{choice}".constantize %> |
|
13 | <% scm_class = "Repository::#{choice}".constantize %> | |
13 | <% text, value = (choice.is_a?(Array) ? choice : [choice, choice]) %> |
|
14 | <% text, value = (choice.is_a?(Array) ? choice : [choice, choice]) %> | |
14 | <% setting = :enabled_scm %> |
|
15 | <% setting = :enabled_scm %> | |
15 | <tr> |
|
16 | <tr> | |
16 | <td class="scm_name"> |
|
17 | <td class="scm_name"> | |
17 | <%= |
|
18 | <%= | |
18 | check_box_tag( |
|
19 | check_box_tag( | |
19 | "settings[#{setting}][]", |
|
20 | "settings[#{setting}][]", | |
20 | value, |
|
21 | value, | |
21 | Setting.send(setting).include?(value)) |
|
22 | Setting.send(setting).include?(value)) | |
22 | %> |
|
23 | %> | |
23 | <%= text.to_s %> |
|
24 | <%= text.to_s %> | |
24 | </td> |
|
25 | </td> | |
25 | <td> |
|
26 | <td> | |
26 | <%= |
|
27 | <%= | |
27 | image_tag( |
|
28 | image_tag( | |
28 | (scm_class.scm_available ? 'true.png' : 'exclamation.png'), |
|
29 | (scm_class.scm_available ? 'true.png' : 'exclamation.png'), | |
29 | :style => "vertical-align:bottom;" |
|
30 | :style => "vertical-align:bottom;" | |
30 | ) |
|
31 | ) | |
31 | %> |
|
32 | %> | |
32 | <%= scm_class.scm_command %> |
|
33 | <%= scm_class.scm_command %> | |
33 | </td> |
|
34 | </td> | |
34 | <td> |
|
35 | <td> | |
35 | <%= scm_class.scm_version_string %> |
|
36 | <%= scm_class.scm_version_string %> | |
36 | </td> |
|
37 | </td> | |
37 | </tr> |
|
38 | </tr> | |
38 | <% end %> |
|
39 | <% end %> | |
39 | </table> |
|
40 | </table> | |
40 | <p><em><%= l(:text_scm_config) %></em></p> |
|
41 | <p><em><%= l(:text_scm_config) %></em></p> | |
41 | </fieldset> |
|
42 | </fieldset> | |
42 |
|
43 | |||
43 | <div class="box tabular settings"> |
|
44 | <div class="box tabular settings"> | |
44 | <p><%= setting_check_box :autofetch_changesets %></p> |
|
45 | <p><%= setting_check_box :autofetch_changesets %></p> | |
45 |
|
46 | |||
46 | <p><%= setting_check_box :sys_api_enabled, |
|
47 | <p><%= setting_check_box :sys_api_enabled, | |
47 | :onclick => |
|
48 | :onclick => | |
48 | "if (this.checked) { Form.Element.enable('settings_sys_api_key'); } else { Form.Element.disable('settings_sys_api_key'); }" %></p> |
|
49 | "if (this.checked) { Form.Element.enable('settings_sys_api_key'); } else { Form.Element.disable('settings_sys_api_key'); }" %></p> | |
49 |
|
50 | |||
50 | <p><%= setting_text_field :sys_api_key, |
|
51 | <p><%= setting_text_field :sys_api_key, | |
51 | :size => 30, |
|
52 | :size => 30, | |
52 | :id => 'settings_sys_api_key', |
|
53 | :id => 'settings_sys_api_key', | |
53 | :disabled => !Setting.sys_api_enabled?, |
|
54 | :disabled => !Setting.sys_api_enabled?, | |
54 | :label => :setting_mail_handler_api_key %> |
|
55 | :label => :setting_mail_handler_api_key %> | |
55 | <%= link_to_function l(:label_generate_key), |
|
56 | <%= link_to_function l(:label_generate_key), | |
56 | "if ($('settings_sys_api_key').disabled == false) { $('settings_sys_api_key').value = randomKey(20) }" %> |
|
57 | "if ($('settings_sys_api_key').disabled == false) { $('settings_sys_api_key').value = randomKey(20) }" %> | |
57 | </p> |
|
58 | </p> | |
58 |
|
59 | |||
59 | <p><%= setting_text_field :repository_log_display_limit, :size => 6 %></p> |
|
60 | <p><%= setting_text_field :repository_log_display_limit, :size => 6 %></p> | |
60 | </div> |
|
61 | </div> | |
61 |
|
62 | |||
62 | <fieldset class="box tabular settings"> |
|
63 | <fieldset class="box tabular settings"> | |
63 | <legend><%= l(:text_issues_ref_in_commit_messages) %></legend> |
|
64 | <legend><%= l(:text_issues_ref_in_commit_messages) %></legend> | |
64 | <p><%= setting_text_field :commit_ref_keywords, :size => 30 %><br /> |
|
65 | <p><%= setting_text_field :commit_ref_keywords, :size => 30 %><br /> | |
65 | <em><%= l(:text_comma_separated) %></em></p> |
|
66 | <em><%= l(:text_comma_separated) %></em></p> | |
66 |
|
67 | |||
67 | <p><%= setting_text_field :commit_fix_keywords, :size => 30 %> |
|
68 | <p><%= setting_text_field :commit_fix_keywords, :size => 30 %> | |
68 | <%= l(:label_applied_status) %>: <%= setting_select :commit_fix_status_id, |
|
69 | <%= l(:label_applied_status) %>: <%= setting_select :commit_fix_status_id, | |
69 | [["", 0]] + |
|
70 | [["", 0]] + | |
70 | IssueStatus.find(:all).collect{ |
|
71 | IssueStatus.find(:all).collect{ | |
71 | |status| [status.name, status.id.to_s] |
|
72 | |status| [status.name, status.id.to_s] | |
72 | }, |
|
73 | }, | |
73 | :label => false %> |
|
74 | :label => false %> | |
74 | <%= l(:field_done_ratio) %>: <%= setting_select :commit_fix_done_ratio, |
|
75 | <%= l(:field_done_ratio) %>: <%= setting_select :commit_fix_done_ratio, | |
75 | (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, |
|
76 | (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, | |
76 | :blank => :label_no_change_option, |
|
77 | :blank => :label_no_change_option, | |
77 | :label => false %> |
|
78 | :label => false %> | |
78 | <br /><em><%= l(:text_comma_separated) %></em></p> |
|
79 | <br /><em><%= l(:text_comma_separated) %></em></p> | |
79 |
|
80 | |||
80 | <p><%= setting_check_box :commit_logtime_enabled, |
|
81 | <p><%= setting_check_box :commit_logtime_enabled, | |
81 | :onclick => |
|
82 | :onclick => | |
82 | "if (this.checked) { Form.Element.enable('settings_commit_logtime_activity_id'); } else { Form.Element.disable('settings_commit_logtime_activity_id'); }"%></p> |
|
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 | <p><%= setting_select :commit_logtime_activity_id, |
|
85 | <p><%= setting_select :commit_logtime_activity_id, | |
85 | [[l(:label_default), 0]] + |
|
86 | [[l(:label_default), 0]] + | |
86 | TimeEntryActivity.shared.active.collect{|activity| [activity.name, activity.id.to_s]}, |
|
87 | TimeEntryActivity.shared.active.collect{|activity| [activity.name, activity.id.to_s]}, | |
87 | :disabled => !Setting.commit_logtime_enabled?%></p> |
|
88 | :disabled => !Setting.commit_logtime_enabled?%></p> | |
88 | </fieldset> |
|
89 | </fieldset> | |
89 |
|
90 | |||
90 | <%= submit_tag l(:button_save) %> |
|
91 | <%= submit_tag l(:button_save) %> | |
91 | <% end %> |
|
92 | <% end %> |
@@ -1,59 +1,61 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../test_helper', __FILE__) | |
19 | require 'settings_controller' |
|
19 | require 'settings_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class SettingsController; def rescue_action(e) raise e end; end |
|
22 | class SettingsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class SettingsControllerTest < ActionController::TestCase |
|
24 | class SettingsControllerTest < ActionController::TestCase | |
25 | fixtures :users |
|
25 | fixtures :users | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = SettingsController.new |
|
28 | @controller = SettingsController.new | |
29 | @request = ActionController::TestRequest.new |
|
29 | @request = ActionController::TestRequest.new | |
30 | @response = ActionController::TestResponse.new |
|
30 | @response = ActionController::TestResponse.new | |
31 | User.current = nil |
|
31 | User.current = nil | |
32 | @request.session[:user_id] = 1 # admin |
|
32 | @request.session[:user_id] = 1 # admin | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | def test_index |
|
35 | def test_index | |
36 | get :index |
|
36 | get :index | |
37 | assert_response :success |
|
37 | assert_response :success | |
38 | assert_template 'edit' |
|
38 | assert_template 'edit' | |
39 | end |
|
39 | end | |
40 |
|
40 | |||
41 | def test_get_edit |
|
41 | def test_get_edit | |
42 | get :edit |
|
42 | get :edit | |
43 | assert_response :success |
|
43 | assert_response :success | |
44 | assert_template 'edit' |
|
44 | assert_template 'edit' | |
|
45 | ||||
|
46 | assert_tag 'input', :attributes => {:name => 'settings[enabled_scm][]', :value => ''} | |||
45 | end |
|
47 | end | |
46 |
|
48 | |||
47 | def test_post_edit_notifications |
|
49 | def test_post_edit_notifications | |
48 | post :edit, :settings => {:mail_from => 'functional@test.foo', |
|
50 | post :edit, :settings => {:mail_from => 'functional@test.foo', | |
49 | :bcc_recipients => '0', |
|
51 | :bcc_recipients => '0', | |
50 | :notified_events => %w(issue_added issue_updated news_added), |
|
52 | :notified_events => %w(issue_added issue_updated news_added), | |
51 | :emails_footer => 'Test footer' |
|
53 | :emails_footer => 'Test footer' | |
52 | } |
|
54 | } | |
53 | assert_redirected_to '/settings/edit' |
|
55 | assert_redirected_to '/settings/edit' | |
54 | assert_equal 'functional@test.foo', Setting.mail_from |
|
56 | assert_equal 'functional@test.foo', Setting.mail_from | |
55 | assert !Setting.bcc_recipients? |
|
57 | assert !Setting.bcc_recipients? | |
56 | assert_equal %w(issue_added issue_updated news_added), Setting.notified_events |
|
58 | assert_equal %w(issue_added issue_updated news_added), Setting.notified_events | |
57 | assert_equal 'Test footer', Setting.emails_footer |
|
59 | assert_equal 'Test footer', Setting.emails_footer | |
58 | end |
|
60 | end | |
59 | end |
|
61 | end |
General Comments 0
You need to be logged in to leave comments.
Login now