Feature #13849 » grouped-filter-trunk-r11902.diff
app/helpers/queries_helper.rb | ||
---|---|---|
29 | 29 |
end |
30 | 30 |
end |
31 | 31 | |
32 |
def grouped_filters_options_for_select(query) |
|
33 |
option_hash = ActiveSupport::OrderedHash.new |
|
34 |
query.available_filters.each do |field, field_options| |
|
35 |
if field_options[:type] == :relation |
|
36 |
label = :label_related_issues |
|
37 |
elsif field_options[:type] == :date_past || field_options[:type] == :date |
|
38 |
label = :label_grouped_filter_date |
|
39 |
else |
|
40 |
label = :label_grouped_filter_non_date |
|
41 |
end |
|
42 |
(option_hash[label] ||= []) << [field_options[:name], field] |
|
43 |
end |
|
44 |
options = [] |
|
45 |
option_hash.each do |k, v| |
|
46 |
options << [l(k), v] |
|
47 |
end |
|
48 |
grouped_options_for_select(options) |
|
49 |
end |
|
50 | ||
32 | 51 |
def query_filters_hidden_tags(query) |
33 | 52 |
tags = ''.html_safe |
34 | 53 |
query.filters.each do |field, options| |
app/views/queries/_filters.html.erb | ||
---|---|---|
20 | 20 |
</td> |
21 | 21 |
<td class="add-filter"> |
22 | 22 |
<%= label_tag('add_filter_select', l(:label_filter_add)) %> |
23 |
<%= select_tag 'add_filter_select', filters_options_for_select(query), :name => nil %> |
|
23 |
<%= select_tag('add_filter_select', |
|
24 |
content_tag(:option) + |
|
25 |
grouped_filters_options_for_select(query), |
|
26 |
:name => nil) %> |
|
24 | 27 |
</td> |
25 | 28 |
</tr> |
26 | 29 |
</table> |
config/locales/en.yml | ||
---|---|---|
893 | 893 |
label_cross_project_hierarchy: With project hierarchy |
894 | 894 |
label_cross_project_system: With all projects |
895 | 895 |
label_gantt_progress_line: Progress line |
896 |
label_grouped_filter_non_date: Filters |
|
897 |
label_grouped_filter_date: Date filters |
|
896 | 898 | |
897 | 899 |
button_login: Login |
898 | 900 |
button_submit: Submit |
public/javascripts/application.js | ||
---|---|---|
106 | 106 |
} |
107 | 107 |
$('#cb_'+fieldId).attr('checked', true); |
108 | 108 |
toggleFilter(field); |
109 |
$('#add_filter_select').val('').children('option').each(function() { |
|
109 |
$('#add_filter_select').val('').children('optgroup').children('option').each(function() {
|
|
110 | 110 |
if ($(this).attr('value') == field) { |
111 | 111 |
$(this).attr('disabled', true); |
112 | 112 |
} |