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

@ -45,6 +45,11 @@ module QueriesHelper
(query.inline_columns & query.available_inline_columns).reject(&:frozen?).collect {|column| [column.caption, column.name]} (query.inline_columns & query.available_inline_columns).reject(&:frozen?).collect {|column| [column.caption, column.name]}
end 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) def column_header(column)
column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption,
:default_order => column.default_order) : :default_order => column.default_order) :

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

@ -17,10 +17,10 @@
<td> <td>
<%= label_tag "selected_columns", l(:description_selected_columns) %> <%= label_tag "selected_columns", l(:description_selected_columns) %>
<br /> <br />
<%= select_tag((defined?(tag_name) ? tag_name : 'c[]'), <%= select_tag tag_name,
options_for_select(query_selected_inline_columns_options(query)), options_for_select(query_selected_inline_columns_options(query)),
:id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px", :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>
<td class="buttons"> <td class="buttons">
<input type="button" value="&#8593;" onclick="moveOptionUp(this.form.selected_columns);" /><br /> <input type="button" value="&#8593;" onclick="moveOptionUp(this.form.selected_columns);" /><br />

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

@ -22,11 +22,9 @@
<fieldset class="box"> <fieldset class="box">
<legend><%= l(:setting_issue_list_default_columns) %></legend> <legend><%= l(:setting_issue_list_default_columns) %></legend>
<%= render :partial => 'queries/columns', <%= render_query_columns_selection(
:locals => { IssueQuery.new(:column_names => Setting.issue_list_default_columns),
:query => IssueQuery.new(:column_names => Setting.issue_list_default_columns), :name => 'settings[issue_list_default_columns]') %>
:tag_name => 'settings[issue_list_default_columns][]'
} %>
</fieldset> </fieldset>
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>

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