Link to go to previous translation
This commit is contained in:
parent
8fb99a9eee
commit
466c6a76f5
|
@ -29,8 +29,9 @@
|
|||
<tr><th>{% trans "Flags" %}</th></tr>
|
||||
<tr><td>{{ unit.flags }}</td></tr>
|
||||
<tr><td></td><td>
|
||||
<a href="{{ unit.translation.get_translate_url }}?type={{ type }}&oldpos={{ unit.position }}&dir=back">{% trans "Previous" %}</a>
|
||||
<input type="submit" value="{% trans "Save" %}" />
|
||||
<a href="{{ unit.translation.get_translate_url }}?type={{ type }}&oldpos={{ unit.position }}">{% trans "Skip" %}</a>
|
||||
<a href="{{ unit.translation.get_translate_url }}?type={{ type }}&oldpos={{ unit.position }}">{% trans "Next" %}</a>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
|
|
@ -43,6 +43,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')
|
||||
try:
|
||||
pos = int(pos)
|
||||
|
@ -63,7 +64,10 @@ def translate(request, project, subproject, lang):
|
|||
|
||||
else:
|
||||
# What unit to show
|
||||
unit = obj.unit_set.filter_type(rqtype).filter(position__gt = pos)[0]
|
||||
if direction == 'back':
|
||||
unit = obj.unit_set.filter_type(rqtype).filter(position__lt = pos)[0]
|
||||
else:
|
||||
unit = obj.unit_set.filter_type(rqtype).filter(position__gt = pos)[0]
|
||||
|
||||
# Prepare form
|
||||
form = TranslationForm(initial = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user