Commit 07a698bc authored by Michal Čihař's avatar Michal Čihař

Saner name for position parameter

parent 6e2a72ca
......@@ -16,10 +16,10 @@
<p>{% blocktrans with unit.position as position %}Showing string {{ position }} out of {{ total }}.{% endblocktrans %}
<span class="navi">
<a class="button-first" href="{{ unit.translation.get_translate_url }}?type={{ type }}&amp;oldpos=1&amp;dir=stay{{ search_url }}">{% trans "First" %}</a>
<a class="button-prev" href="{{ unit.translation.get_translate_url }}?type={{ type }}&amp;oldpos={{ unit.position }}&amp;dir=back{{ search_url }}">{% trans "Previous" %}</a>
<a class="button-next" href="{{ unit.translation.get_translate_url }}?type={{ type }}&amp;oldpos={{ unit.position }}{{ search_url }}">{% trans "Next" %}</a>
<a class="button-end" href="{{ unit.translation.get_translate_url }}?type={{ type }}&amp;oldpos={{ total }}&amp;dir=stay{{ search_url }}">{% trans "Last" %}</a>
<a class="button-first" href="{{ unit.translation.get_translate_url }}?type={{ type }}&amp;pos=1&amp;dir=stay{{ search_url }}">{% trans "First" %}</a>
<a class="button-prev" href="{{ unit.translation.get_translate_url }}?type={{ type }}&amp;pos={{ unit.position }}&amp;dir=back{{ search_url }}">{% trans "Previous" %}</a>
<a class="button-next" href="{{ unit.translation.get_translate_url }}?type={{ type }}&amp;pos={{ unit.position }}{{ search_url }}">{% trans "Next" %}</a>
<a class="button-end" href="{{ unit.translation.get_translate_url }}?type={{ type }}&amp;pos={{ total }}&amp;dir=stay{{ search_url }}">{% trans "Last" %}</a>
</span>
</p>
......@@ -30,7 +30,7 @@
<form action="{{ unit.translation.get_translate_url }}" method="post">
{% csrf_token %}
<input type="hidden" name="type" value="{{ type }}" />
<input type="hidden" name="oldpos" value="{{ unit.position }}" />
<input type="hidden" name="pos" value="{{ unit.position }}" />
<input type="hidden" name="q" value="{{ search_query }}" />
<input type="hidden" name="exact" value="{{ search_exact }}" />
<input type="hidden" name="src" value="{{ search_source }}" />
......@@ -101,10 +101,10 @@
{% if perms.trans.accept_suggestion or perms.trans.delete_suggestion %}
<div class="suggestionactions">
{% if perms.trans.accept_suggestion %}
<a href="{{ suggestion.get_translate_url }}?type={{ type }}&amp;oldpos={{ unit.position }}&amp;accept={{ suggestion.id }}{{ search_url }}" class="sug-accept">Accept</a>
<a href="{{ suggestion.get_translate_url }}?type={{ type }}&amp;pos={{ unit.position }}&amp;accept={{ suggestion.id }}{{ search_url }}" class="sug-accept">Accept</a>
{% endif %}
{% if perms.trans.delete_suggestion %}
<a href="{{ suggestion.get_translate_url }}?type={{ type }}&amp;oldpos={{ unit.position }}&amp;delete={{ suggestion.id }}{{ search_url }}" class="sug-delete">Delete</a>
<a href="{{ suggestion.get_translate_url }}?type={{ type }}&amp;pos={{ unit.position }}&amp;delete={{ suggestion.id }}{{ search_url }}" class="sug-delete">Delete</a>
{% endif %}
</div>
{% endif %}
......
......@@ -479,7 +479,7 @@ class Unit(models.Model):
ordering = ['position']
def get_absolute_url(self):
return '%s?oldpos=%d&dir=stay' % (self.translation.get_translate_url(), self.position)
return '%s?pos=%d&dir=stay' % (self.translation.get_translate_url(), self.position)
def update_from_unit(self, unit, pos, force):
location = ', '.join(unit.getlocations())
......
......@@ -127,7 +127,7 @@ def translate(request, project, subproject, lang):
# Check where we are
rqtype = request.REQUEST.get('type', 'all')
direction = request.REQUEST.get('dir', 'forward')
pos = request.REQUEST.get('oldpos', '-1')
pos = request.REQUEST.get('pos', '-1')
try:
pos = int(pos)
except:
......@@ -212,7 +212,7 @@ def translate(request, project, subproject, lang):
# Show message to user
messages.add_message(request, messages.ERROR, _('Some checks have failed on your translation!'))
# Stay on same entry
return HttpResponseRedirect('%s?type=%s&oldpos=%d&dir=stay%s' % (
return HttpResponseRedirect('%s?type=%s&pos=%d&dir=stay%s' % (
obj.get_translate_url(),
rqtype,
pos,
......@@ -220,7 +220,7 @@ def translate(request, project, subproject, lang):
))
# Redirect to next entry
return HttpResponseRedirect('%s?type=%s&oldpos=%d%s' % (
return HttpResponseRedirect('%s?type=%s&pos=%d%s' % (
obj.get_translate_url(),
rqtype,
pos,
......@@ -235,7 +235,7 @@ def translate(request, project, subproject, lang):
# Check for authenticated users
if not request.user.is_authenticated():
messages.add_message(request, messages.ERROR, _('You need to log in to be able to manage suggestions!'))
return HttpResponseRedirect('%s?type=%s&oldpos=%d&dir=stay%s' % (
return HttpResponseRedirect('%s?type=%s&pos=%d&dir=stay%s' % (
obj.get_translate_url(),
rqtype,
pos,
......@@ -246,7 +246,7 @@ def translate(request, project, subproject, lang):
if 'accept' in request.GET:
if not request.user.has_perm('trans.accept_suggestion'):
messages.add_message(request, messages.ERROR, _('You do not have privilege to accept suggestions!'))
return HttpResponseRedirect('%s?type=%s&oldpos=%d&dir=stay%s' % (
return HttpResponseRedirect('%s?type=%s&pos=%d&dir=stay%s' % (
obj.get_translate_url(),
rqtype,
pos,
......@@ -256,7 +256,7 @@ def translate(request, project, subproject, lang):
else:
if not request.user.has_perm('trans.delete_suggestion'):
messages.add_message(request, messages.ERROR, _('You do not have privilege to delete suggestions!'))
return HttpResponseRedirect('%s?type=%s&oldpos=%d&dir=stay%s' % (
return HttpResponseRedirect('%s?type=%s&pos=%d&dir=stay%s' % (
obj.get_translate_url(),
rqtype,
pos,
......@@ -279,7 +279,7 @@ def translate(request, project, subproject, lang):
messages.add_message(request, messages.ERROR, _('Invalid suggestion!'))
# Redirect to same entry for possible editing
return HttpResponseRedirect('%s?type=%s&oldpos=%d&dir=stay%s' % (
return HttpResponseRedirect('%s?type=%s&pos=%d&dir=stay%s' % (
obj.get_translate_url(),
rqtype,
pos,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment