rails_admin_globalize 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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+"?target_locale="+$("#target_locale_select").val());
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
+ }
@@ -1,3 +1,3 @@
1
1
  module RailsAdminGlobalize
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrea Zaupa