From c656456a1e3612ad706d1f736f11f2cf8f0950e5 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 25 Feb 2011 14:46:11 +0100 Subject: [PATCH 1/5] introduce any-operator --- config/locales/de.yml | 1 + config/locales/en.yml | 1 + lib/report/operator.rb | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/config/locales/de.yml b/config/locales/de.yml index d706dc9c6a..97abac70f4 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -3,6 +3,7 @@ de: units: Einheiten label_less: "<" label_greater: ">" + label_any: "alle" label_report: "Report" label_columns: "Spalten" label_rows: "Zeilen" diff --git a/config/locales/en.yml b/config/locales/en.yml index a8dcdf20d7..e47beb3ac6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,6 +3,7 @@ en: units: Units label_less: "<" label_greater: ">" + label_any: "any" label_report: "Report" label_columns: "Columns" label_rows: "Rows" diff --git a/lib/report/operator.rb b/lib/report/operator.rb index 7bce779ee6..fb3a22b87a 100644 --- a/lib/report/operator.rb +++ b/lib/report/operator.rb @@ -174,6 +174,12 @@ class Report::Operator end end + new "any", :label => :label_any, :arity => 0 do + def modify(query, field, value) + query + end + end + end ############################################################################################# From 893fa820c100fb6db36f32ffc69380183c088958 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 25 Feb 2011 14:47:39 +0100 Subject: [PATCH 2/5] have the any-operator as one of our default operators --- lib/report/operator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/report/operator.rb b/lib/report/operator.rb index fb3a22b87a..ace5fb34d9 100644 --- a/lib/report/operator.rb +++ b/lib/report/operator.rb @@ -236,7 +236,7 @@ class Report::Operator end def self.default_operators - ["=", "!"].map { |s| s.to_operator} + ["=", "!", "any"].map { |s| s.to_operator} end attr_reader :name From 04e52f2c1c2f7dd3e1e367bc4e35dae3ae20b965 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 25 Feb 2011 15:32:02 +0100 Subject: [PATCH 3/5] better english translation for :label_any --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index e47beb3ac6..3cad3a9038 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,7 +3,7 @@ en: units: Units label_less: "<" label_greater: ">" - label_any: "any" + label_any: "is any" label_report: "Report" label_columns: "Columns" label_rows: "Rows" From 2aed3aba384a74ffa6d06638f353429eb913be03 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 25 Feb 2011 15:32:23 +0100 Subject: [PATCH 4/5] have valid arity for any-operator --- lib/report/operator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/report/operator.rb b/lib/report/operator.rb index ace5fb34d9..3e8d815922 100644 --- a/lib/report/operator.rb +++ b/lib/report/operator.rb @@ -175,7 +175,7 @@ class Report::Operator end new "any", :label => :label_any, :arity => 0 do - def modify(query, field, value) + def modify(query, field, value = nil) query end end From d56df6d92d73afb5c1762a746fc1fec9778d1137 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 25 Feb 2011 15:32:42 +0100 Subject: [PATCH 5/5] fix filter.js operator_changed() bugs --- assets/javascripts/reporting/filters.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/reporting/filters.js b/assets/javascripts/reporting/filters.js index ec36da8994..fde9c93461 100644 --- a/assets/javascripts/reporting/filters.js +++ b/assets/javascripts/reporting/filters.js @@ -54,7 +54,7 @@ Reporting.Filters = { field_el.removeAttribute('data-selected'); $('rm_' + field).value = ""; // reset the value, so the serialized form will not return this filter } - Reporting.Filters.operator_changed(field, $("operators_" + field)); + Reporting.Filters.operator_changed(field, $("operators[" + field + "]")); Reporting.Filters.display_category($(field_el.getAttribute("data-label"))); } }, @@ -85,7 +85,7 @@ Reporting.Filters = { change_argument_visibility: function (field, arg_nr) { var params, i; - params = [$(field + '_arg_1'), $(field + '_arg_2')]; + params = [$(field + '_arg_1_val'), $(field + '_arg_2_val')]; for (i = 0; i < 2; i += 1) { if (params[i] !== null) {