From 0c854a9e50df58ca4f18eef2ae0350ca5aa2e3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= Date: Mon, 21 Oct 2019 17:15:50 +0200 Subject: [PATCH] pages: always display placeholder blocks in skeleton (#26641) --- combo/manager/templates/combo/page_view.html | 6 ++++++ combo/public/templates/combo/placeholder.html | 6 +++--- combo/public/templatetags/combo.py | 2 +- tests/test_public.py | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/combo/manager/templates/combo/page_view.html b/combo/manager/templates/combo/page_view.html index 83646bce..2860371c 100644 --- a/combo/manager/templates/combo/page_view.html +++ b/combo/manager/templates/combo/page_view.html @@ -91,6 +91,12 @@
+{% if object.redirect_url %} +
+

{% blocktrans with redirect_url=object.redirect_url %}This page is configured as a redirection to the URL "{{ redirect_url }}", it can also be used as a template for the pages behind this URL.{% endblocktrans %}

+
+{% endif %} +
diff --git a/combo/public/templates/combo/placeholder.html b/combo/public/templates/combo/placeholder.html index 71830a13..695dbdca 100644 --- a/combo/public/templates/combo/placeholder.html +++ b/combo/public/templates/combo/placeholder.html @@ -1,5 +1,8 @@ {% load combo i18n %} {% if render %} +{% if render_skeleton %} +{{ skeleton }} +{% endif %} {% for cell in cells %}
{% render_cell cell %}
{% endfor %} -{% if render_skeleton %} -{{ skeleton }} -{% endif %} {% endif %} diff --git a/combo/public/templatetags/combo.py b/combo/public/templatetags/combo.py index 9688eea7..5d3583b0 100644 --- a/combo/public/templatetags/combo.py +++ b/combo/public/templatetags/combo.py @@ -67,7 +67,7 @@ def placeholder(context, placeholder_name, **options): x.placeholder == placeholder_name and (context.get('render_skeleton') or x.is_relevant(context) and x.is_visible(context['request'].user))] - if context.get('render_skeleton') and not context['cells']: + if context.get('render_skeleton'): context['skeleton'] = skeleton_text(context, placeholder_name) else: context['skeleton'] = '' diff --git a/tests/test_public.py b/tests/test_public.py index 70a2b98c..fdd495c7 100644 --- a/tests/test_public.py +++ b/tests/test_public.py @@ -270,7 +270,7 @@ def test_page_skeleton(app): cell.save() resp = app.get('/__skeleton__/?source=%s' % quote('http://example.net')) assert '{% block placeholder-content %}{% block content %}{% endblock %}{% endblock %}' in resp.text - assert not '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text + assert '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text assert 'Foobar' in resp.text # check {% now %} inside a skeleton_extra_placeholder is not interpreted @@ -282,7 +282,7 @@ def test_page_skeleton(app): page.save() resp = app.get('/__skeleton__/?source=%s' % quote('http://127.0.0.1:8999/')) assert '{% block placeholder-content %}{% block content %}{% endblock %}{% endblock %}' in resp.text - assert not '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text + assert '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text assert 'Foobar' in resp.text # check link cells provide a full URL