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

Saner name for position parameter

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