@@ -1,34 +1,34 | |||||
1 | <table class="query-columns"> |
|
1 | <table class="query-columns"> | |
2 | <tr> |
|
2 | <tr> | |
3 | <td style="padding-left:0"> |
|
3 | <td style="padding-left:0"> | |
4 | <%= label_tag "available_columns", l(:description_available_columns) %> |
|
4 | <%= label_tag "available_columns", l(:description_available_columns) %> | |
5 | <br /> |
|
5 | <br /> | |
6 | <%= select_tag 'available_columns', |
|
6 | <%= select_tag 'available_columns', | |
7 | options_for_select((query.available_columns - query.columns).collect {|column| [column.caption, column.name]}), |
|
7 | options_for_select((query.available_columns - query.columns).collect {|column| [column.caption, column.name]}), | |
8 | :multiple => true, :size => 10, :style => "width:150px", |
|
8 | :multiple => true, :size => 10, :style => "width:150px", | |
9 | :ondblclick => "moveOptions(this.form.available_columns, this.form.selected_columns);" %> |
|
9 | :ondblclick => "moveOptions(this.form.available_columns, this.form.selected_columns);" %> | |
10 | </td> |
|
10 | </td> | |
11 | <td class="buttons"> |
|
11 | <td class="buttons"> | |
12 | <input type="button" value="→" |
|
12 | <input type="button" value="→" | |
13 | onclick="moveOptions(this.form.available_columns, this.form.selected_columns);" /><br /> |
|
13 | onclick="moveOptions(this.form.available_columns, this.form.selected_columns);" /><br /> | |
14 | <input type="button" value="←" |
|
14 | <input type="button" value="←" | |
15 | onclick="moveOptions(this.form.selected_columns, this.form.available_columns);" /> |
|
15 | onclick="moveOptions(this.form.selected_columns, this.form.available_columns);" /> | |
16 | </td> |
|
16 | </td> | |
17 | <td> |
|
17 | <td> | |
18 | <%= label_tag "selected_columns", l(:description_selected_columns) %> |
|
18 | <%= label_tag "selected_columns", l(:description_selected_columns) %> | |
19 | <br /> |
|
19 | <br /> | |
20 | <%= select_tag 'c[]', |
|
20 | <%= select_tag((defined?(tag_name) ? tag_name : 'c[]'), | |
21 | options_for_select(query.columns.collect {|column| [column.caption, column.name]}), |
|
21 | options_for_select(query.columns.collect {|column| [column.caption, column.name]}), | |
22 | :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px", |
|
22 | :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px", | |
23 | :ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);" %> |
|
23 | :ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);") %> | |
24 | </td> |
|
24 | </td> | |
25 | <td class="buttons"> |
|
25 | <td class="buttons"> | |
26 | <input type="button" value="↑" onclick="moveOptionUp(this.form.selected_columns);" /><br /> |
|
26 | <input type="button" value="↑" onclick="moveOptionUp(this.form.selected_columns);" /><br /> | |
27 | <input type="button" value="↓" onclick="moveOptionDown(this.form.selected_columns);" /> |
|
27 | <input type="button" value="↓" onclick="moveOptionDown(this.form.selected_columns);" /> | |
28 | </td> |
|
28 | </td> | |
29 | </tr> |
|
29 | </tr> | |
30 | </table> |
|
30 | </table> | |
31 |
|
31 | |||
32 | <% content_for :header_tags do %> |
|
32 | <% content_for :header_tags do %> | |
33 | <%= javascript_include_tag 'select_list_move' %> |
|
33 | <%= javascript_include_tag 'select_list_move' %> | |
34 | <% end %> |
|
34 | <% end %> |
@@ -1,25 +1,29 | |||||
1 | <%= form_tag({:action => 'edit', :tab => 'issues'}) do %> |
|
1 | <%= form_tag({:action => 'edit', :tab => 'issues'}, :onsubmit => 'selectAllOptions("selected_columns");') do %> | |
2 |
|
2 | |||
3 | <div class="box tabular settings"> |
|
3 | <div class="box tabular settings"> | |
4 | <p><%= setting_check_box :cross_project_issue_relations %></p> |
|
4 | <p><%= setting_check_box :cross_project_issue_relations %></p> | |
5 |
|
5 | |||
6 | <p><%= setting_check_box :issue_group_assignment %></p> |
|
6 | <p><%= setting_check_box :issue_group_assignment %></p> | |
7 |
|
7 | |||
8 | <p><%= setting_check_box :default_issue_start_date_to_creation_date %></p> |
|
8 | <p><%= setting_check_box :default_issue_start_date_to_creation_date %></p> | |
9 |
|
9 | |||
10 | <p><%= setting_check_box :display_subprojects_issues %></p> |
|
10 | <p><%= setting_check_box :display_subprojects_issues %></p> | |
11 |
|
11 | |||
12 | <p><%= setting_select :issue_done_ratio, Issue::DONE_RATIO_OPTIONS.collect {|i| [l("setting_issue_done_ratio_#{i}"), i]} %></p> |
|
12 | <p><%= setting_select :issue_done_ratio, Issue::DONE_RATIO_OPTIONS.collect {|i| [l("setting_issue_done_ratio_#{i}"), i]} %></p> | |
13 |
|
13 | |||
14 | <p><%= setting_text_field :issues_export_limit, :size => 6 %></p> |
|
14 | <p><%= setting_text_field :issues_export_limit, :size => 6 %></p> | |
15 |
|
15 | |||
16 | <p><%= setting_text_field :gantt_items_limit, :size => 6 %></p> |
|
16 | <p><%= setting_text_field :gantt_items_limit, :size => 6 %></p> | |
17 | </div> |
|
17 | </div> | |
18 |
|
18 | |||
19 | <fieldset class="box settings"><legend><%= l(:setting_issue_list_default_columns) %></legend> |
|
19 | <fieldset class="box"> | |
20 |
<%= setting_ |
|
20 | <legend><%= l(:setting_issue_list_default_columns) %></legend> | |
21 | Query.new.available_columns.collect {|c| [c.caption, c.name.to_s]}, :label => false) %> |
|
21 | <%= render :partial => 'queries/columns', | |
|
22 | :locals => { | |||
|
23 | :query => Query.new(:column_names => Setting.issue_list_default_columns), | |||
|
24 | :tag_name => 'settings[issue_list_default_columns][]' | |||
|
25 | } %> | |||
22 | </fieldset> |
|
26 | </fieldset> | |
23 |
|
27 | |||
24 | <%= submit_tag l(:button_save) %> |
|
28 | <%= submit_tag l(:button_save) %> | |
25 | <% end %> |
|
29 | <% end %> |
@@ -1,90 +1,110 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2012 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 |
|
45 | |||
46 | assert_tag 'input', :attributes => {:name => 'settings[enabled_scm][]', :value => ''} |
|
46 | assert_tag 'input', :attributes => {:name => 'settings[enabled_scm][]', :value => ''} | |
47 | end |
|
47 | end | |
48 |
|
48 | |||
|
49 | def test_get_edit_should_preselect_default_issue_list_columns | |||
|
50 | with_settings :issue_list_default_columns => %w(tracker subject status updated_on) do | |||
|
51 | get :edit | |||
|
52 | assert_response :success | |||
|
53 | end | |||
|
54 | ||||
|
55 | assert_select 'select[id=selected_columns][name=?]', 'settings[issue_list_default_columns][]' do | |||
|
56 | assert_select 'option', 4 | |||
|
57 | assert_select 'option[value=tracker]', :text => 'Tracker' | |||
|
58 | assert_select 'option[value=subject]', :text => 'Subject' | |||
|
59 | assert_select 'option[value=status]', :text => 'Status' | |||
|
60 | assert_select 'option[value=updated_on]', :text => 'Updated' | |||
|
61 | end | |||
|
62 | ||||
|
63 | assert_select 'select[id=available_columns]' do | |||
|
64 | assert_select 'option[value=tracker]', 0 | |||
|
65 | assert_select 'option[value=priority]', :text => 'Priority' | |||
|
66 | end | |||
|
67 | end | |||
|
68 | ||||
49 | def test_post_edit_notifications |
|
69 | def test_post_edit_notifications | |
50 | post :edit, :settings => {:mail_from => 'functional@test.foo', |
|
70 | post :edit, :settings => {:mail_from => 'functional@test.foo', | |
51 | :bcc_recipients => '0', |
|
71 | :bcc_recipients => '0', | |
52 | :notified_events => %w(issue_added issue_updated news_added), |
|
72 | :notified_events => %w(issue_added issue_updated news_added), | |
53 | :emails_footer => 'Test footer' |
|
73 | :emails_footer => 'Test footer' | |
54 | } |
|
74 | } | |
55 | assert_redirected_to '/settings/edit' |
|
75 | assert_redirected_to '/settings/edit' | |
56 | assert_equal 'functional@test.foo', Setting.mail_from |
|
76 | assert_equal 'functional@test.foo', Setting.mail_from | |
57 | assert !Setting.bcc_recipients? |
|
77 | assert !Setting.bcc_recipients? | |
58 | assert_equal %w(issue_added issue_updated news_added), Setting.notified_events |
|
78 | assert_equal %w(issue_added issue_updated news_added), Setting.notified_events | |
59 | assert_equal 'Test footer', Setting.emails_footer |
|
79 | assert_equal 'Test footer', Setting.emails_footer | |
60 | end |
|
80 | end | |
61 |
|
81 | |||
62 | def test_get_plugin_settings |
|
82 | def test_get_plugin_settings | |
63 | Setting.stubs(:plugin_foo).returns({'sample_setting' => 'Plugin setting value'}) |
|
83 | Setting.stubs(:plugin_foo).returns({'sample_setting' => 'Plugin setting value'}) | |
64 | ActionController::Base.append_view_path(File.join(Rails.root, "test/fixtures/plugins")) |
|
84 | ActionController::Base.append_view_path(File.join(Rails.root, "test/fixtures/plugins")) | |
65 | Redmine::Plugin.register :foo do |
|
85 | Redmine::Plugin.register :foo do | |
66 | settings :partial => "foo_plugin/foo_plugin_settings" |
|
86 | settings :partial => "foo_plugin/foo_plugin_settings" | |
67 | end |
|
87 | end | |
68 |
|
88 | |||
69 | get :plugin, :id => 'foo' |
|
89 | get :plugin, :id => 'foo' | |
70 | assert_response :success |
|
90 | assert_response :success | |
71 | assert_template 'plugin' |
|
91 | assert_template 'plugin' | |
72 | assert_tag 'form', :attributes => {:action => '/settings/plugin/foo'}, |
|
92 | assert_tag 'form', :attributes => {:action => '/settings/plugin/foo'}, | |
73 | :descendant => {:tag => 'input', :attributes => {:name => 'settings[sample_setting]', :value => 'Plugin setting value'}} |
|
93 | :descendant => {:tag => 'input', :attributes => {:name => 'settings[sample_setting]', :value => 'Plugin setting value'}} | |
74 |
|
94 | |||
75 | Redmine::Plugin.clear |
|
95 | Redmine::Plugin.clear | |
76 | end |
|
96 | end | |
77 |
|
97 | |||
78 | def test_get_invalid_plugin_settings |
|
98 | def test_get_invalid_plugin_settings | |
79 | get :plugin, :id => 'none' |
|
99 | get :plugin, :id => 'none' | |
80 | assert_response 404 |
|
100 | assert_response 404 | |
81 | end |
|
101 | end | |
82 |
|
102 | |||
83 | def test_post_plugin_settings |
|
103 | def test_post_plugin_settings | |
84 | Setting.expects(:plugin_foo=).with({'sample_setting' => 'Value'}).returns(true) |
|
104 | Setting.expects(:plugin_foo=).with({'sample_setting' => 'Value'}).returns(true) | |
85 | Redmine::Plugin.register(:foo) {} |
|
105 | Redmine::Plugin.register(:foo) {} | |
86 |
|
106 | |||
87 | post :plugin, :id => 'foo', :settings => {'sample_setting' => 'Value'} |
|
107 | post :plugin, :id => 'foo', :settings => {'sample_setting' => 'Value'} | |
88 | assert_redirected_to '/settings/plugin/foo' |
|
108 | assert_redirected_to '/settings/plugin/foo' | |
89 | end |
|
109 | end | |
90 | end |
|
110 | end |
General Comments 0
You need to be logged in to leave comments.
Login now