wcs: no div cell--body if custom schema is empty (#58326)
gitea-wip/combo/pipeline/head There was a failure building this commit Details
gitea/combo/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Lauréline Guérin 2021-12-17 16:56:28 +01:00
parent fe2b81816b
commit d666dd6f64
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 12 additions and 2 deletions

View File

@ -9,9 +9,10 @@
{% endblock %}
{% if card.id %}
<div class="cell--body">
{% spaceless %}
{% if cell.custom_schema %}
{% if cell.custom_schema.cells %}
<div class="cell--body">
<div class="{{ cell.custom_schema.grid_class }}">
{% for item in cell.custom_schema.cells %}
<div class="{{ item.cell_size|default:"" }}">
@ -45,8 +46,11 @@
</div>
{% endfor%}
</div>
</div>
{% endif %}
{% else %}
<div class="cell--body">
{% for field in schema.fields %}
{% if 'varname' in field and field.varname %}
{% with card.fields|get:field.varname as value %}
@ -57,9 +61,9 @@
{% endwith %}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endspaceless %}
</div>
{% else %}
<div class="cell--body">

View File

@ -2116,6 +2116,12 @@ def test_card_cell_render_custom_schema(mock_send, context, app):
cell_resp = app.get(cell_url + '?ctx=' + extra_ctx[i])
assert '<p class="label">Foo bar baz X%sY</p>' % i in cell_resp
# custom schema but empty
cell.custom_schema = {'cells': []}
cell.save()
result = cell.render(context)
assert PyQuery(result).find('div.cell--body') == []
@mock.patch('combo.apps.wcs.utils.requests.send', side_effect=mocked_requests_send)
def test_card_cell_render_identifier(mock_send, nocache, app):