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