wcs: add generic support for a picture in forms of a category cell (#27972)
This commit is contained in:
parent
d40cb57e27
commit
9831984afb
|
@ -1,12 +1,20 @@
|
|||
{% load i18n %}
|
||||
{% load assets i18n %}
|
||||
{% block cell-content %}
|
||||
<div class="wcs-forms-of-category-{{slug}}">
|
||||
{% block cell-header %}
|
||||
<h2>{{ title }}</h2>
|
||||
{% get_asset "wcs:category:picture:"|add:cell.category_reference as asset %}
|
||||
{% if asset %}
|
||||
<picture>
|
||||
<img src="{% asset_url asset size="440x240" crop="center" %}" alt="">
|
||||
</picture>
|
||||
{% endif %}
|
||||
{% if description %}
|
||||
<div class="intro">
|
||||
{{ description|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
<ul>
|
||||
{% for form in forms %}
|
||||
<li class="{% if form.authentication_required %}required-authentication{% endif %}
|
||||
|
|
|
@ -305,7 +305,12 @@ COMBO_ASSET_SLOTS = {}
|
|||
|
||||
# dynamic slots created for wcs category/form cells
|
||||
# example: {'picture': {'prefix': 'Picture'}}
|
||||
WCS_CATEGORY_ASSET_SLOTS = {}
|
||||
WCS_CATEGORY_ASSET_SLOTS = {
|
||||
'picture': {
|
||||
'prefix': _('Picture'),
|
||||
},
|
||||
}
|
||||
|
||||
WCS_FORM_ASSET_SLOTS = {}
|
||||
|
||||
# hide work-in-progress/experimental/whatever cells for now
|
||||
|
|
|
@ -640,8 +640,9 @@ def test_cell_assets(app, admin_user):
|
|||
cell.save()
|
||||
|
||||
app = login(app)
|
||||
resp = app.get('/manage/assets/')
|
||||
assert 'have any asset yet.' in resp.text
|
||||
with override_settings(WCS_CATEGORY_ASSET_SLOTS={}):
|
||||
resp = app.get('/manage/assets/')
|
||||
assert 'have any asset yet.' in resp.text
|
||||
|
||||
with override_settings(
|
||||
WCS_CATEGORY_ASSET_SLOTS={'logo': {'prefix': 'Logo'}},
|
||||
|
|
Loading…
Reference in New Issue