summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauréline Guérin <zebuline@entrouvert.com>2019-10-21 15:15:50 (GMT)
committerLauréline Guérin <zebuline@entrouvert.com>2019-10-29 09:17:12 (GMT)
commit0c854a9e50df58ca4f18eef2ae0350ca5aa2e3de (patch)
tree418a0f44c92d2bdf78a3bcb004db665a145b5562
parent7087aa3849c7186ebd4fe020c230f802bda8698e (diff)
downloadcombo-wip/26641-redirect.zip
combo-wip/26641-redirect.tar.gz
combo-wip/26641-redirect.tar.bz2
pages: always display placeholder blocks in skeleton (#26641)wip/26641-redirect
-rw-r--r--combo/manager/templates/combo/page_view.html6
-rw-r--r--combo/public/templates/combo/placeholder.html6
-rw-r--r--combo/public/templatetags/combo.py2
-rw-r--r--tests/test_public.py4
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 83646bc..2860371 100644
--- a/combo/manager/templates/combo/page_view.html
+++ b/combo/manager/templates/combo/page_view.html
@@ -91,6 +91,12 @@
<div id="page-content">
+{% if object.redirect_url %}
+<div class="infonotice">
+ <p>{% 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 %}</p>
+</div>
+{% endif %}
+
<div id="placeholders"
data-cell-order-url="{% url 'combo-manager-cell-order' page_pk=object.id %}"
>
diff --git a/combo/public/templates/combo/placeholder.html b/combo/public/templates/combo/placeholder.html
index 71830a1..695dbdc 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 %}
<div class="cell {{ cell.css_class_names }} {% if cell.slug %}{{cell.slug}}{% endif %} {% if cell|shown_because_admin:request %}shown-because-admin{% endif %}"
{% if cell.slug and cell.use_slug_as_id %}id="{{ cell.slug }}"{% endif %}
@@ -9,7 +12,4 @@
{% if request.extra_context_data %}data-extra-context="{{ request.extra_context_data|signed|urlencode }}"{% endif %}
><div>{% render_cell cell %}</div></div>
{% endfor %}
-{% if render_skeleton %}
-{{ skeleton }}
-{% endif %}
{% endif %}
diff --git a/combo/public/templatetags/combo.py b/combo/public/templatetags/combo.py
index 9688eea..5d3583b 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 70a2b98..fdd495c 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