Commit e8fdfd6d authored by Michal Čihař's avatar Michal Čihař

Properly indicate end of translation in zen mode

parent 8bbbcaed
...@@ -689,6 +689,8 @@ def get_zen_unitdata(translation, request): ...@@ -689,6 +689,8 @@ def get_zen_unitdata(translation, request):
if isinstance(search_result, HttpResponse): if isinstance(search_result, HttpResponse):
return search_result return search_result
search_result['last_section'] = offset + 20 >= len(search_result['ids'])
units = translation.unit_set.filter( units = translation.unit_set.filter(
pk__in=search_result['ids'][offset:offset + 20] pk__in=search_result['ids'][offset:offset + 20]
) )
...@@ -725,6 +727,7 @@ def zen(request, project, subproject, lang): ...@@ -725,6 +727,7 @@ def zen(request, project, subproject, lang):
'search_query': search_result['query'], 'search_query': search_result['query'],
'filter_name': search_result['name'], 'filter_name': search_result['name'],
'filter_count': len(search_result['ids']), 'filter_count': len(search_result['ids']),
'last_section': search_result['last_section'],
} }
) )
) )
...@@ -745,6 +748,7 @@ def load_zen(request, project, subproject, lang): ...@@ -745,6 +748,7 @@ def load_zen(request, project, subproject, lang):
'translation': translation, 'translation': translation,
'unitdata': unitdata, 'unitdata': unitdata,
'search_query': search_result['query'], 'search_query': search_result['query'],
'last_section': search_result['last_section'],
} }
) )
) )
...@@ -30,3 +30,8 @@ ...@@ -30,3 +30,8 @@
</tr> </tr>
{% endfor %} {% endfor %}
{% if last_section %}
<tr><td colspan="3" id="last-section">
{% show_message 'info' _('You have reached end of translation.') %}
</td></tr>
{% endif %}
...@@ -424,6 +424,9 @@ $(function () { ...@@ -424,6 +424,9 @@ $(function () {
if ($('.zen').length > 0) { if ($('.zen').length > 0) {
$(window).scroll(function(){ $(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()) { if ($(window).scrollTop() == $(document).height() - $(window).height()) {
if ($('#last-section').length > 0) {
return;
}
$('#loading-next').show(); $('#loading-next').show();
var loader = $('#zen-load'); var loader = $('#zen-load');
......
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