]> source.dussan.org Git - redmine.git/commitdiff
Adds an helper for rendering query columns selection.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 23 Feb 2013 12:14:22 +0000 (12:14 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 23 Feb 2013 12:14:22 +0000 (12:14 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11452 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/queries_helper.rb
app/views/issues/index.html.erb
app/views/queries/_columns.html.erb
app/views/queries/_form.html.erb
app/views/settings/_issues.html.erb
app/views/timelog/_date_range.html.erb

index 77fe4c23046d85ff9ba375429ea2f7c93e923d95..592bba42ad24129df43c92ec4cd0874d953f1d55 100644 (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) :
index 864c7d554196c824df74d80a23f93ae9a340c5c0..0e4f940b29dcf4b926f95cc9e85030a64772bf4c 100644 (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>
index f359c1615b77b678153453686978767dbab91a86..0d624d989a51206277dc4ce21c86eaf190b4c2bc 100644 (file)
     <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 />
index 32f6aab27b6a4c5be70a6b766cf646079630fd2b..12244eb701d98a02f08859c22a536cef0c7df23e 100644 (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>
index 7b0d96fa3eb523ead62f00b66a5cb60f4838bc01..2efc6e8c29c29c85961c84349e8aa8a306bf2d36 100644 (file)
 
 <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) %>
index 295be910ee18fa395175659b6e34544eadde051a..a889f160c7195d513761ed22e0699ad5c93e5db0 100644 (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>