diff --git a/app/views/queries/_columns.html.erb b/app/views/queries/_columns.html.erb index 7c1f8d5ab..5e665fd75 100644 --- a/app/views/queries/_columns.html.erb +++ b/app/views/queries/_columns.html.erb @@ -17,10 +17,10 @@ <%= label_tag "selected_columns", l(:description_selected_columns) %>
- <%= select_tag 'c[]', + <%= select_tag((defined?(tag_name) ? tag_name : 'c[]'), options_for_select(query.columns.collect {|column| [column.caption, column.name]}), :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px", - :ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);" %> + :ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);") %>
diff --git a/app/views/settings/_issues.html.erb b/app/views/settings/_issues.html.erb index 429685638..6c9bf4553 100644 --- a/app/views/settings/_issues.html.erb +++ b/app/views/settings/_issues.html.erb @@ -1,4 +1,4 @@ -<%= form_tag({:action => 'edit', :tab => 'issues'}) do %> +<%= form_tag({:action => 'edit', :tab => 'issues'}, :onsubmit => 'selectAllOptions("selected_columns");') do %>

<%= setting_check_box :cross_project_issue_relations %>

@@ -16,9 +16,13 @@

<%= setting_text_field :gantt_items_limit, :size => 6 %>

-
<%= l(:setting_issue_list_default_columns) %> -<%= setting_multiselect(:issue_list_default_columns, - Query.new.available_columns.collect {|c| [c.caption, c.name.to_s]}, :label => false) %> +
+ <%= l(:setting_issue_list_default_columns) %> + <%= render :partial => 'queries/columns', + :locals => { + :query => Query.new(:column_names => Setting.issue_list_default_columns), + :tag_name => 'settings[issue_list_default_columns][]' + } %>
<%= submit_tag l(:button_save) %> diff --git a/test/functional/settings_controller_test.rb b/test/functional/settings_controller_test.rb index b178e0162..0457e70f2 100644 --- a/test/functional/settings_controller_test.rb +++ b/test/functional/settings_controller_test.rb @@ -46,6 +46,26 @@ class SettingsControllerTest < ActionController::TestCase assert_tag 'input', :attributes => {:name => 'settings[enabled_scm][]', :value => ''} end + def test_get_edit_should_preselect_default_issue_list_columns + with_settings :issue_list_default_columns => %w(tracker subject status updated_on) do + get :edit + assert_response :success + end + + assert_select 'select[id=selected_columns][name=?]', 'settings[issue_list_default_columns][]' do + assert_select 'option', 4 + assert_select 'option[value=tracker]', :text => 'Tracker' + assert_select 'option[value=subject]', :text => 'Subject' + assert_select 'option[value=status]', :text => 'Status' + assert_select 'option[value=updated_on]', :text => 'Updated' + end + + assert_select 'select[id=available_columns]' do + assert_select 'option[value=tracker]', 0 + assert_select 'option[value=priority]', :text => 'Priority' + end + end + def test_post_edit_notifications post :edit, :settings => {:mail_from => 'functional@test.foo', :bcc_recipients => '0',