scvmc_redmine_6397_parent_task.diff

Patch which implements feature 6397 - Stuart Cianos, 2010-09-18 03:20

Download (3.6 KB)

View differences:

app/models/query.rb (working copy)
180 180
                           "start_date" => { :type => :date, :order => 11 },
181 181
                           "due_date" => { :type => :date, :order => 12 },
182 182
                           "estimated_hours" => { :type => :integer, :order => 13 },
183
                           "done_ratio" =>  { :type => :integer, :order => 14 }}
183
                           "done_ratio" =>  { :type => :integer, :order => 14 },
184
                           "root_id" => { :type => :integer, :order => 16, :caption => "field_parent_issue" },
185
                           }
184 186
    
185 187
    user_values = []
186 188
    user_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
......
366 368
  # Returns the SQL sort order that should be prepended for grouping
367 369
  def group_by_sort_order
368 370
    if grouped? && (column = group_by_column)
371
      # Clean up duplicate SQL order modifiers when sortable field is postfixed
372
      # with "asc" or "desc". Allows such fields to be groupable.
369 373
      column.sortable.is_a?(Array) ?
370
        column.sortable.collect {|s| "#{s} #{column.default_order}"}.join(',') :
371
        "#{column.sortable} #{column.default_order}"
374
        column.sortable.collect {|s| s.slice(-4,4).upcase==" ASC"?s : s.slice(-5, 5).upcase==" DESC"?s : s+" #{column.default_order}"}.join(',') :
375
        "#{column.sortable}".slice(-4,4).upcase==" ASC"?"#{column.sortable}" : "#{column.sortable}".slice(-5, 5).upcase==" DESC"?"#{column.sortable}" : "#{column.sortable} #{column.default_order}"
372 376
    end
373 377
  end
374 378
  
app/views/queries/_filters.rhtml (working copy)
78 78
    <tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>" class="filter">
79 79
    <td style="width:200px;">
80 80
        <%= check_box_tag 'fields[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %>
81
        <label for="cb_<%= field %>"><%= filter[1][:name] || l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label>
81
        <label for="cb_<%= field %>"><%= filter[1][:name] || options[:caption] == nil ? l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) : l(options[:caption].to_sym) %></label>
82 82
    </td>
83 83
    <td style="width:150px;">
84 84
        <%= select_tag "operators[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :id => "operators_#{field}", :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %>
......
107 107
</td>
108 108
<td class="add-filter">
109 109
<%= label_tag('add_filter_select', l(:label_filter_add)) %>:
110
<%= select_tag 'add_filter_select', options_for_select([["",""]] + query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [ field[1][:name] || l(("field_"+field[0].to_s.gsub(/_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact),
110
<%= select_tag 'add_filter_select', options_for_select([["",""]] + query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [ field[1][:name] || (field[1][:caption] == nil ? l(("field_"+field[0].to_s.gsub(/_id$/, "")).to_sym) : l(field[1][:caption].to_sym)), field[0]] unless query.has_filter?(field[0])}.compact),
111 111
																		:onchange => "add_filter();",
112 112
																		:class => "select-small",
113 113
																		:name => nil %>