js_routes 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,8 +18,11 @@
|
|
18
18
|
$.each(paramsHash, function(name, value) {
|
19
19
|
var pattern, replacement;
|
20
20
|
if (path.match(new RegExp(":" + name))) {
|
21
|
-
pattern = "(.*?)\\(
|
21
|
+
pattern = "(.*?)\\(([\\.\\/\\w]*?):" + name + "(\\(.*?\\)|[^\\)]*)?\\)(.*)";
|
22
22
|
replacement = "$1$2" + value + "$3$4";
|
23
|
+
path = path.replace(new RegExp(pattern), replacement);
|
24
|
+
pattern = "(.*?):" + name + "(.*)";
|
25
|
+
replacement = "$1" + value + "$2";
|
23
26
|
return path = path.replace(new RegExp(pattern), replacement);
|
24
27
|
} else {
|
25
28
|
return extraParams[name] = value;
|
@@ -12,9 +12,13 @@ $.buildPath = (path, params...) ->
|
|
12
12
|
# try to insert parameters
|
13
13
|
$.each paramsHash, (name, value) ->
|
14
14
|
if path.match(new RegExp(":#{name}"))
|
15
|
-
pattern = "(.*?)\\(
|
15
|
+
pattern = "(.*?)\\(([\\.\\/\\w]*?):#{name}(\\(.*?\\)|[^\\)]*)?\\)(.*)"
|
16
16
|
replacement = "$1$2#{value}$3$4"
|
17
17
|
path = path.replace new RegExp(pattern), replacement
|
18
|
+
|
19
|
+
pattern = "(.*?):#{name}(.*)"
|
20
|
+
replacement = "$1#{value}$2"
|
21
|
+
path = path.replace new RegExp(pattern), replacement
|
18
22
|
else extraParams[name] = value
|
19
23
|
|
20
24
|
# cleanup
|
data/lib/js_routes/version.rb
CHANGED