(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) :
<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>
<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="↑" onclick="moveOptionUp(this.form.selected_columns);" /><br />
<%= 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>
<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) %>
<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>