send user back to the same page before changing the display language.

This commit is contained in:
Andreas Kotowicz 2011-11-27 09:43:51 +01:00
parent 5a92dafbdc
commit eaf78115d2
3 changed files with 7 additions and 3 deletions

View File

@ -99,7 +99,7 @@
{% if helpdesk_settings.HELPDESK_FOOTER_SHOW_API_LINK %}<a href='{% url helpdesk_api_help %}'>{% trans "API" %}</a>{% endif %} {% if helpdesk_settings.HELPDESK_FOOTER_SHOW_API_LINK %}<a href='{% url helpdesk_api_help %}'>{% trans "API" %}</a>{% endif %}
<a href='{% url helpdesk_user_settings %}'>{% trans "User Settings" %}</a> <a href='{% url helpdesk_user_settings %}'>{% trans "User Settings" %}</a>
{% if helpdesk_settings.HELPDESK_FOOTER_SHOW_CHANGE_LANGUAGE_LINK %} {% if helpdesk_settings.HELPDESK_FOOTER_SHOW_CHANGE_LANGUAGE_LINK %}
<a href='{% url helpdesk_public_change_language %}'>{% trans "Change Language" %}</a> <a href='{% url helpdesk_public_change_language %}?return_to={{ request.path }}'>{% trans "Change Language" %}</a>
{% endif %} {% endif %}
{% if user.is_superuser %}<a href='{% url helpdesk_system_settings %}'>{% trans "System Settings" %}</a>{% endif %}</p> {% if user.is_superuser %}<a href='{% url helpdesk_system_settings %}'>{% trans "System Settings" %}</a>{% endif %}</p>
</div> </div>

View File

@ -6,7 +6,7 @@
<h3>{% trans "Change the display language" %}</h3> <h3>{% trans "Change the display language" %}</h3>
<form action="/i18n/setlang/" method="post"> <form action="/i18n/setlang/" method="post">
{% csrf_token %} {% csrf_token %}
<input name="next" type="hidden" value="/" /> <input name="next" type="hidden" value="{{ next|default:"/" }}" />
<select name="language"> <select name="language">
{% get_language_info_list for LANGUAGES as languages %} {% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %} {% for language in languages %}

View File

@ -132,5 +132,9 @@ def view_ticket(request):
})) }))
def change_language(request): def change_language(request):
return_to = ''
if request.GET.has_key('return_to'):
return_to = request.GET['return_to']
return render_to_response('helpdesk/public_change_language.html', return render_to_response('helpdesk/public_change_language.html',
RequestContext(request, {})) RequestContext(request, {'next': return_to}))