diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index e22efc5bea..b19e687e3c 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -29,7 +29,18 @@ module QueriesHelper def operators_for_select(filter) - filter.available_operators.map { |o| [o.human_name, o.to_sym] } + # We do not support OnDate(Time) and BetweenDate(Time) + # for rails based filters + operators = filter + .available_operators + .reject do |o| + [Queries::Operators::OnDate, + Queries::Operators::OnDateTime, + Queries::Operators::BetweenDate, + Queries::Operators::BetweenDateTime].include?(o) + end + + operators.map { |o| [o.human_name, o.to_sym] } end def entries_for_filter_select_sorted(query) diff --git a/app/views/queries/_filters.html.erb b/app/views/queries/_filters.html.erb index e6aa2b1f13..719aa1b6f4 100644 --- a/app/views/queries/_filters.html.erb +++ b/app/views/queries/_filters.html.erb @@ -52,7 +52,7 @@ See doc/COPYRIGHT.rdoc for more details. if (check_box.prop('checked')) { operator.show().prop('disabled', false); values.show().prop('disabled', false); - toggle_operator(field, operator); + toggle_operator(field); } else { operator.hide(); filter.hide(); @@ -61,8 +61,9 @@ See doc/COPYRIGHT.rdoc for more details. } } - function toggle_operator(field, operator) { - switch (operator.value) { + function toggle_operator(field) { + var operator = jQuery("#operators_" + field); + switch (operator.val()) { case "!*": case "*": case "t": @@ -84,8 +85,8 @@ See doc/COPYRIGHT.rdoc for more details. } function apply_filters_observer() { - jQuery('#query_form input[type=text]').each(function (a) { - jQuery(a).on('keypress', function (e) { + jQuery('#query_form input[type=text]').each(function (index, filter) { + jQuery(filter).on('keypress', function (e) { if ((e.keyCode || e.which) == 13) { selectAllOptions("selected_columns"); jQuery.ajax({ @@ -118,20 +119,19 @@ See doc/COPYRIGHT.rdoc for more details. query.filter_for(field).try(:operator)), id: "operators_#{field}", onchange: "toggle_operator('#{field}');", - class: "advanced-filters--select", - style: "vertical-align: top;" %> + class: "advanced-filters--select" %>