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
This commit is contained in:
Jean-Philippe Lang 2013-02-23 12:14:22 +00:00
parent 1ac8fd8c42
commit d255e98023
6 changed files with 13 additions and 10 deletions

View File

@ -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) :

View File

@ -24,7 +24,7 @@
<table>
<tr>
<td><%= l(:field_column_names) %></td>
<td><%= render :partial => 'queries/columns', :locals => {:query => @query} %></td>
<td><%= render_query_columns_selection(@query) %></td>
</tr>
<tr>
<td><label for='group_by'><%= l(:field_group_by) %></label></td>

View File

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

View File

@ -49,7 +49,7 @@
<%= content_tag 'fieldset', :id => 'columns', :style => (query.has_default_columns? ? 'display:none;' : nil) do %>
<legend><%= l(:field_column_names) %></legend>
<%= render :partial => 'queries/columns', :locals => {:query => query}%>
<%= render render_query_columns_selection(query) %>
<% end %>
</div>

View File

@ -22,11 +22,9 @@
<fieldset class="box">
<legend><%= l(:setting_issue_list_default_columns) %></legend>
<%= 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]') %>
</fieldset>
<%= submit_tag l(:button_save) %>

View File

@ -11,7 +11,7 @@
<table>
<tr>
<td><%= l(:field_column_names) %></td>
<td><%= render :partial => 'queries/columns', :locals => {:query => @query} %></td>
<td><%= render_query_columns_selection(@query) %></td>
</tr>
</table>
</div>