Defect #22123 » Totalable_columns.patch
app/helpers/queries_helper.rb Sat Jan 30 13:32:54 2016 +0000 → app/helpers/queries_helper.rb Tue Mar 01 15:19:15 2016 +0100 | ||
---|---|---|
87 | 87 |
def available_totalable_columns_tags(query) |
88 | 88 |
tags = ''.html_safe |
89 | 89 |
query.available_totalable_columns.each do |column| |
90 |
tags << content_tag('label', check_box_tag('t[]', column.name.to_s, query.totalable_columns.include?(column), :id => nil) + " #{column.caption}", :class => 'inline') |
|
90 |
tags << content_tag('label', check_box_tag('t[]', column.name.to_s, query.totalable_columns.include?(column), :id => nil) + " #{column.caption}", :class => 'inline', :onchange => 'document.getElementById(\'include_totals\').value=$(\'input[name="t[]"]\').is(\':checked\');')
|
|
91 | 91 |
end |
92 | 92 |
tags |
93 | 93 |
end |
app/models/query.rb Sat Jan 30 13:32:54 2016 +0000 → app/models/query.rb Tue Mar 01 15:19:15 2016 +0100 | ||
---|---|---|
250 | 250 |
end |
251 | 251 |
self.group_by = params[:group_by] || (params[:query] && params[:query][:group_by]) |
252 | 252 |
self.column_names = params[:c] || (params[:query] && params[:query][:column_names]) |
253 |
options[:include_totals] = params[:include_totals].present? ? params[:include_totals].match(/false/).nil? : true |
|
253 | 254 |
self.totalable_names = params[:t] || (params[:query] && params[:query][:totalable_names]) |
254 | 255 |
self |
255 | 256 |
end |
... | ... | |
511 | 512 |
end |
512 | 513 | |
513 | 514 |
def totalable_names |
515 |
options[:include_totals] = true unless !options[:include_totals].nil? |
|
514 | 516 |
options[:totalable_names] || Setting.issue_list_default_totals.map(&:to_sym) || [] |
515 | 517 |
end |
516 | 518 |
app/views/issues/index.html.erb Sat Jan 30 13:32:54 2016 +0000 → app/views/issues/index.html.erb Tue Mar 01 15:19:15 2016 +0100 | ||
---|---|---|
42 | 42 |
<tr> |
43 | 43 |
<td><%= l(:label_total_plural) %></td> |
44 | 44 |
<td><%= available_totalable_columns_tags(@query) %></td> |
45 |
<%= hidden_field_tag('include_totals', params[:include_totals]) %></td> |
|
45 | 46 |
</tr> |
46 | 47 |
</table> |
47 | 48 |
</div> |