Feature #13849 » grouped-filter-trunk-r13207.diff
app/helpers/queries_helper.rb (working copy) | ||
---|---|---|
31 | 31 |
end |
32 | 32 |
end |
33 | 33 | |
34 |
def grouped_filters_options_for_select(query) |
|
35 |
option_hash = ActiveSupport::OrderedHash.new |
|
36 |
query.available_filters.each do |field, field_options| |
|
37 |
if field_options[:type] == :relation |
|
38 |
label = :label_related_issues |
|
39 |
elsif field_options[:type] == :date_past || field_options[:type] == :date |
|
40 |
label = :label_grouped_filter_date |
|
41 |
else |
|
42 |
label = :label_grouped_filter_non_date |
|
43 |
end |
|
44 |
(option_hash[label] ||= []) << [field_options[:name], field] |
|
45 |
end |
|
46 |
options = [] |
|
47 |
option_hash.each do |k, v| |
|
48 |
options << [l(k), v] |
|
49 |
end |
|
50 |
grouped_options_for_select(options) |
|
51 |
end |
|
52 | ||
34 | 53 |
def query_filters_hidden_tags(query) |
35 | 54 |
tags = ''.html_safe |
36 | 55 |
query.filters.each do |field, options| |
app/views/queries/_filters.html.erb (working copy) | ||
---|---|---|
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 (working copy) | ||
---|---|---|
915 | 915 |
label_check_for_updates: Check for updates |
916 | 916 |
label_latest_compatible_version: Latest compatible version |
917 | 917 |
label_unknown_plugin: Unknown plugin |
918 |
label_grouped_filter_non_date: Filters |
|
919 |
label_grouped_filter_date: Date filters |
|
918 | 920 | |
919 | 921 |
button_login: Login |
920 | 922 |
button_submit: Submit |
public/javascripts/application.js (working copy) | ||
---|---|---|
102 | 102 |
} |
103 | 103 |
$('#cb_'+fieldId).attr('checked', true); |
104 | 104 |
toggleFilter(field); |
105 |
$('#add_filter_select').val('').children('option').each(function() { |
|
105 |
$('#add_filter_select').val('').children('optgroup').children('option').each(function() {
|
|
106 | 106 |
if ($(this).attr('value') == field) { |
107 | 107 |
$(this).attr('disabled', true); |
108 | 108 |
} |