rails_admin_globalize 0.0.1 → 0.0.2
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.
@@ -1,6 +1,17 @@
|
|
1
1
|
$(function() {
|
2
2
|
$("#target_locale_select").live("change", function(e) {
|
3
3
|
var url = $("#target_locale_select").data("target-url");
|
4
|
-
location.replace(url
|
4
|
+
location.replace(updateQueryStringParameter(url, "target_locale", $("#target_locale_select").val()));
|
5
5
|
});
|
6
6
|
});
|
7
|
+
|
8
|
+
function updateQueryStringParameter(uri, key, value) {
|
9
|
+
var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i");
|
10
|
+
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
|
11
|
+
if (uri.match(re)) {
|
12
|
+
return uri.replace(re, '$1' + key + "=" + value + '$2');
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
return uri + separator + key + "=" + value;
|
16
|
+
}
|
17
|
+
}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_globalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrea Zaupa
|