combo/combo/apps/wcs/templates/combo/wcs/cards.html

73 lines
2.0 KiB
HTML

{% load i18n %}
{% block cell-content %}
{% block cell-header %}
{% if title %}<h2>{{ title|force_escape }}</h2>{% endif %}
{% include "combo/asset_picture_fragment.html" %}
{% endblock %}
{% if card_objects %}
{% with cell.get_custom_schema as custom_schema %}
{% if cell.custom_schema and cell.custom_schema.cells|length > 1 %}
<div class="pk-table-wrapper">
<table class="pk-data-table pk-table-headers">
{% if custom_schema.grid_headers %}
<thead>
{% for item in custom_schema.cells %}
{% if item.varname == "@custom@" %}
{% if item.template %}
<th>{{ item.header|default:"" }}</th>
{% endif %}
{% elif item.varname == "@link@" %}
{% if item.template and item.page|default:item.url_template %}
<th>{{ item.header|default:"" }}</th>
{% endif %}
{% else %}
{% if item.varname %}
{% with fields_by_varnames|get:item.varname as field %}
{% if field %}
<th>{{ field.label }}</th>
{% endif %}
{% endwith %}
{% endif %}
{% endif %}
{% endfor %}
</thead>
{% endif %}
<tbody>
{% for card in card_objects %}
<tr>
{% for item in custom_schema.cells %}
{% include "combo/wcs/cards-field.html" %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="links-list cards-{{ cell.card_slug }} list-of-cards">
<ul>
{% for card in card_objects %}
<li>
{% spaceless %}
{% if custom_schema %}
{% include "combo/wcs/cards-field.html" with item=custom_schema.cells.0 ul_display=True %}
{% else %}
<a href="{% if card_page_base_url %}{{ card_page_base_url }}{{ card.id }}/{% else %}{{ card.url }}{% endif %}"><span class="card-title">{{ card.text }}</span></a>
{% endif %}
{% endspaceless %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% include "combo/pagination.html" %}
{% endwith %}
{% else %}
<div class="cell--body"><p class="empty-message">{% trans "There are no cards." %}</p></div>
{% endif %}
{% endblock %}