pwa: only add navigation markup when entries are defined (#29427)

This commit is contained in:
Frédéric Péters 2019-01-03 15:01:00 +01:00
parent f7ff04f42d
commit a7a8ee2ed1
2 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,5 @@
{% load combo %}
{% if entries|length %}
<div class="pwa-navigation" id="pwa-navigation">
<div>
<ul>
@ -35,3 +36,4 @@ $('body.authenticated-user li[data-notification-count-url]').each(function(idx,
}});
});
</script>
{% endif %}

View File

@ -28,7 +28,7 @@ def pwa_navigation(context):
return ''
pwa_navigation_template = template.loader.get_template('combo/pwa/navigation.html')
context = {
'entries': PwaNavigationEntry.objects.all(),
'entries': list(PwaNavigationEntry.objects.all()),
'user': context.get('user'),
'render_skeleton': context.get('render_skeleton'),
'site_base': context['request'].build_absolute_uri('/')[:-1],