From 4c3b0c41b15b5a776c32f56615c12ebf3f1f759f Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 19 Feb 2012 17:21:23 +0000 Subject: [PATCH] use 'foo=bar,baz' for 'is between', and make sure this gets only parsed for number-like find keys --- source/Ox.UI/js/Core/Ox.URL.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/Ox.UI/js/Core/Ox.URL.js b/source/Ox.UI/js/Core/Ox.URL.js index 29b69b6c..adf5cfdf 100644 --- a/source/Ox.UI/js/Core/Ox.URL.js +++ b/source/Ox.UI/js/Core/Ox.URL.js @@ -8,7 +8,7 @@ Ox.URL URL controller options Options object findKeys <[o]> Find keys id Find key id - type Value type ("string" or "number") + type Value type (like "string" or "integer") getItem Tests if a string matches an item (string, callback) -> undefined string The string to be tested @@ -87,8 +87,8 @@ kv k v > is more than (number) k!>v k v !> is not more than (number) -k=v:w k [v,w] = is between (number), contains (string or text) -k!=v:w k [v,w] != is not between (number), does not contain (string or text) +k=v,w k [v,w] = is between (number), contains (string or text) +k!=v,w k [v,w] != is not between (number), does not contain (string or text) All parts of the URL can be omitted, as long as the order is preserved. @@ -331,7 +331,6 @@ Ox.URL = function(options) { return false; } }); - condition.key = condition.key || '*'; if ( !condition.operator || Ox.getIndexById(self.options.findKeys, condition.key) == -1 @@ -348,7 +347,12 @@ Ox.URL = function(options) { condition.operator = condition.operator.replace('=', '^') } } - if (condition.value.indexOf(',') > -1) { + if ( + ['date', 'enum', 'float', 'integer', 'time', 'year'].indexOf( + Ox.getObjectById(self.options.findKeys, condition.key).type + ) > -1 + && condition.value.indexOf(',') > -1 + ) { condition.value = condition.value.split(',').map(function(value) { return parseValue(decodeValue(value), condition.key); });