From d255e98023e516ea6487fea8c36d7df0a3b39a03 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 23 Feb 2013 12:14:22 +0000 Subject: [PATCH] Adds an helper for rendering query columns selection. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11452 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/queries_helper.rb | 5 +++++ app/views/issues/index.html.erb | 2 +- app/views/queries/_columns.html.erb | 4 ++-- app/views/queries/_form.html.erb | 2 +- app/views/settings/_issues.html.erb | 8 +++----- app/views/timelog/_date_range.html.erb | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 77fe4c230..592bba42a 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -45,6 +45,11 @@ module QueriesHelper (query.inline_columns & query.available_inline_columns).reject(&:frozen?).collect {|column| [column.caption, column.name]} end + def render_query_columns_selection(query, options={}) + tag_name = (options[:name] || 'c') + '[]' + render :partial => 'queries/columns', :locals => {:query => query, :tag_name => tag_name} + end + def column_header(column) column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, :default_order => column.default_order) : diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 864c7d554..0e4f940b2 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -24,7 +24,7 @@ - + diff --git a/app/views/queries/_columns.html.erb b/app/views/queries/_columns.html.erb index f359c1615..0d624d989 100644 --- a/app/views/queries/_columns.html.erb +++ b/app/views/queries/_columns.html.erb @@ -17,10 +17,10 @@
<%= l(:field_column_names) %><%= render :partial => 'queries/columns', :locals => {:query => @query} %><%= render_query_columns_selection(@query) %>
<%= label_tag "selected_columns", l(:description_selected_columns) %>
- <%= select_tag((defined?(tag_name) ? tag_name : 'c[]'), + <%= select_tag tag_name, options_for_select(query_selected_inline_columns_options(query)), :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/queries/_form.html.erb b/app/views/queries/_form.html.erb index 32f6aab27..12244eb70 100644 --- a/app/views/queries/_form.html.erb +++ b/app/views/queries/_form.html.erb @@ -49,7 +49,7 @@ <%= content_tag 'fieldset', :id => 'columns', :style => (query.has_default_columns? ? 'display:none;' : nil) do %> <%= l(:field_column_names) %> -<%= render :partial => 'queries/columns', :locals => {:query => query}%> +<%= render render_query_columns_selection(query) %> <% end %> diff --git a/app/views/settings/_issues.html.erb b/app/views/settings/_issues.html.erb index 7b0d96fa3..2efc6e8c2 100644 --- a/app/views/settings/_issues.html.erb +++ b/app/views/settings/_issues.html.erb @@ -22,11 +22,9 @@
<%= l(:setting_issue_list_default_columns) %> - <%= render :partial => 'queries/columns', - :locals => { - :query => IssueQuery.new(:column_names => Setting.issue_list_default_columns), - :tag_name => 'settings[issue_list_default_columns][]' - } %> + <%= render_query_columns_selection( + IssueQuery.new(:column_names => Setting.issue_list_default_columns), + :name => 'settings[issue_list_default_columns]') %>
<%= submit_tag l(:button_save) %> diff --git a/app/views/timelog/_date_range.html.erb b/app/views/timelog/_date_range.html.erb index 295be910e..a889f160c 100644 --- a/app/views/timelog/_date_range.html.erb +++ b/app/views/timelog/_date_range.html.erb @@ -11,7 +11,7 @@ - +
<%= l(:field_column_names) %><%= render :partial => 'queries/columns', :locals => {:query => @query} %><%= render_query_columns_selection(@query) %>
-- 2.39.5