Index: app/helpers/queries_helper.rb =================================================================== --- app/helpers/queries_helper.rb (revision 13207) +++ app/helpers/queries_helper.rb (working copy) @@ -31,6 +31,25 @@ end end + def grouped_filters_options_for_select(query) + option_hash = ActiveSupport::OrderedHash.new + query.available_filters.each do |field, field_options| + if field_options[:type] == :relation + label = :label_related_issues + elsif field_options[:type] == :date_past || field_options[:type] == :date + label = :label_grouped_filter_date + else + label = :label_grouped_filter_non_date + end + (option_hash[label] ||= []) << [field_options[:name], field] + end + options = [] + option_hash.each do |k, v| + options << [l(k), v] + end + grouped_options_for_select(options) + end + def query_filters_hidden_tags(query) tags = ''.html_safe query.filters.each do |field, options| Index: app/views/queries/_filters.html.erb =================================================================== --- app/views/queries/_filters.html.erb (revision 13207) +++ app/views/queries/_filters.html.erb (working copy) @@ -20,7 +20,10 @@ <%= label_tag('add_filter_select', l(:label_filter_add)) %> -<%= select_tag 'add_filter_select', filters_options_for_select(query), :name => nil %> +<%= select_tag('add_filter_select', + content_tag(:option) + + grouped_filters_options_for_select(query), + :name => nil) %> Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (revision 13207) +++ config/locales/en.yml (working copy) @@ -915,6 +915,8 @@ label_check_for_updates: Check for updates label_latest_compatible_version: Latest compatible version label_unknown_plugin: Unknown plugin + label_grouped_filter_non_date: Filters + label_grouped_filter_date: Date filters button_login: Login button_submit: Submit Index: public/javascripts/application.js =================================================================== --- public/javascripts/application.js (revision 13207) +++ public/javascripts/application.js (working copy) @@ -102,7 +102,7 @@ } $('#cb_'+fieldId).attr('checked', true); toggleFilter(field); - $('#add_filter_select').val('').children('option').each(function() { + $('#add_filter_select').val('').children('optgroup').children('option').each(function() { if ($(this).attr('value') == field) { $(this).attr('disabled', true); }