Projet

Général

Profil

0001-pages-always-display-placeholder-blocks-in-skeleton-.patch

Lauréline Guérin, 22 octobre 2019 15:05

Télécharger (3,06 ko)

Voir les différences:

Subject: [PATCH] pages: always display placeholder blocks in skeleton (#26641)

 combo/manager/templates/combo/page_view.html | 6 ++++++
 combo/public/templatetags/combo.py           | 2 +-
 tests/test_public.py                         | 4 ++--
 3 files changed, 9 insertions(+), 3 deletions(-)
combo/manager/templates/combo/page_view.html
91 91

  
92 92
<div id="page-content">
93 93

  
94
{% if object.redirect_url %}
95
<div class="infonotice">
96
    <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>
97
</div>
98
{% endif %}
99

  
94 100
<div id="placeholders"
95 101
     data-cell-order-url="{% url 'combo-manager-cell-order' page_pk=object.id %}"
96 102
     >
combo/public/templatetags/combo.py
67 67
            x.placeholder == placeholder_name and
68 68
            (context.get('render_skeleton') or x.is_relevant(context) and
69 69
            x.is_visible(context['request'].user))]
70
    if context.get('render_skeleton') and not context['cells']:
70
    if context.get('render_skeleton'):
71 71
        context['skeleton'] = skeleton_text(context, placeholder_name)
72 72
    else:
73 73
        context['skeleton'] = ''
tests/test_public.py
269 269
    cell.save()
270 270
    resp = app.get('/__skeleton__/?source=%s' % quote('http://example.net'))
271 271
    assert '{% block placeholder-content %}{% block content %}{% endblock %}{% endblock %}' in resp.text
272
    assert not '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text
272
    assert '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text
273 273
    assert 'Foobar' in resp.text
274 274

  
275 275
    # check {% now %} inside a skeleton_extra_placeholder is not interpreted
......
281 281
    page.save()
282 282
    resp = app.get('/__skeleton__/?source=%s' % quote('http://127.0.0.1:8999/'))
283 283
    assert '{% block placeholder-content %}{% block content %}{% endblock %}{% endblock %}' in resp.text
284
    assert not '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text
284
    assert '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text
285 285
    assert 'Foobar' in resp.text
286 286

  
287 287
    # check link cells provide a full URL
288
-