summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2012-01-24 10:45:37 +0100
committerJochen Topf <jochen@topf.org>2012-01-24 10:45:37 +0100
commit7fe2786bfb80eae34b165ead01372cd51be90f48 (patch)
treea3b1012232c0b837186d063e3856058f5c869502 /web
parent535ae8974e2405934c44f7c9316d1fdecbc94b13 (diff)
downloadtaginfo-7fe2786bfb80eae34b165ead01372cd51be90f48.tar
taginfo-7fe2786bfb80eae34b165ead01372cd51be90f48.tar.gz
Make language switch work properly with pages containing query parameters or hashes
Diffstat (limited to 'web')
-rw-r--r--web/public/js/taginfo.js1
-rwxr-xr-xweb/taginfo.rb2
-rw-r--r--web/views/layout.erb2
3 files changed, 3 insertions, 2 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js
index ec5a372..f68f51f 100644
--- a/web/public/js/taginfo.js
+++ b/web/public/js/taginfo.js
@@ -366,6 +366,7 @@ jQuery(document).ready(function() {
}
jQuery('#locale').bind('change', function() {
+ jQuery('#url').val(window.location);
jQuery('#set_language').submit();
});
diff --git a/web/taginfo.rb b/web/taginfo.rb
index 7cba07c..0739268 100755
--- a/web/taginfo.rb
+++ b/web/taginfo.rb
@@ -141,7 +141,7 @@ class Taginfo < Sinatra::Base
# It sets a cookie and redirects back to the page the user was coming from.
get '/switch_locale' do
response.set_cookie('taginfo_locale', params[:locale])
- redirect(TaginfoConfig.get('instance.url') + params[:url])
+ redirect(params[:url])
end
#-------------------------------------
diff --git a/web/views/layout.erb b/web/views/layout.erb
index ba71b91..de81b0c 100644
--- a/web/views/layout.erb
+++ b/web/views/layout.erb
@@ -17,7 +17,7 @@
</div>
<div id="header_forms" class="no-print">
<form id="set_language" action="/switch_locale">
- <input type="hidden" name="url" value="<%= request.path %>"/>
+ <input type="hidden" id="url" name="url" value="<%= TaginfoConfig.get('instance.url') + request.path %>"/>
<select id="locale" name="locale">
<% r18n.available_locales.sort{ |a,b| a.title <=> b.title }.each do |locale| %>
<option value="<%= locale.code %>"<%= locale.code == r18n.locale.code ? ' selected="selected"' : ''%>><%= locale.title %>&nbsp;</option>