summaryrefslogtreecommitdiff
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-01-16 14:51:42 -0800
committerelijah <elijah@riseup.net>2016-01-16 14:51:42 -0800
commit41d463b3572a628f0c505e0fefff19f1be9e3609 (patch)
tree5f6459e325fac101ed0d5bc0335f1b452301957c /app/assets/javascripts
parent6dba1392a29a003c3334259a222061f29ff04b13 (diff)
retain locale in URL when logging in and signing up, and ajax actions in general.
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/users.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/assets/javascripts/users.js b/app/assets/javascripts/users.js
index 5217942..70d78fd 100644
--- a/app/assets/javascripts/users.js
+++ b/app/assets/javascripts/users.js
@@ -122,11 +122,21 @@
};
srp.loggedIn = function() {
- return window.location = '/';
+ return srp.localeRedirect('/');
};
srp.updated = function() {
- return window.location = '/users/' + srp.session.id();
+ return srp.localeRedirect('/users/' + srp.session.id());
+ };
+
+ // redirect, while preserving locale if set by url path.
+ srp.localeRedirect = function(path) {
+ var localeMatch = window.location.pathname.match(/^(\/[a-z]{2})\//)
+ if (localeMatch) {
+ return window.location = localeMatch[1] + path;
+ } else {
+ return window.location = path;
+ }
};
//