Ability to set default column order in issue list (#11068).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9780 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-06-08 18:50:22 +00:00
parent b7a435f7a0
commit 77bac4b14d
3 changed files with 30 additions and 6 deletions

View File

@ -17,10 +17,10 @@
<td>
<%= label_tag "selected_columns", l(:description_selected_columns) %>
<br />
<%= 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);") %>
</td>
<td class="buttons">
<input type="button" value="&#8593;" onclick="moveOptionUp(this.form.selected_columns);" /><br />

View File

@ -1,4 +1,4 @@
<%= form_tag({:action => 'edit', :tab => 'issues'}) do %>
<%= form_tag({:action => 'edit', :tab => 'issues'}, :onsubmit => 'selectAllOptions("selected_columns");') do %>
<div class="box tabular settings">
<p><%= setting_check_box :cross_project_issue_relations %></p>
@ -16,9 +16,13 @@
<p><%= setting_text_field :gantt_items_limit, :size => 6 %></p>
</div>
<fieldset class="box settings"><legend><%= l(:setting_issue_list_default_columns) %></legend>
<%= setting_multiselect(:issue_list_default_columns,
Query.new.available_columns.collect {|c| [c.caption, c.name.to_s]}, :label => false) %>
<fieldset class="box">
<legend><%= l(:setting_issue_list_default_columns) %></legend>
<%= render :partial => 'queries/columns',
:locals => {
:query => Query.new(:column_names => Setting.issue_list_default_columns),
:tag_name => 'settings[issue_list_default_columns][]'
} %>
</fieldset>
<%= submit_tag l(:button_save) %>

View File

@ -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',