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

45 lines
2.2 KiB
HTML

{% spaceless %}
{% if item.varname == "@custom@" %}
{% if item.template %}
{% with card.custom_fields|get:item.template|force_escape as value %}
{% if not ul_display %}<td>{% endif %}{{ value }}{% if not ul_display %}</td>{% endif %}
{% endwith %}
{% endif %}
{% elif item.varname == "@link@" %}
{% firstof item.link_field item.page item.url_template as link %}
{% if item.template and link %}
{% if not ul_display %}<td>{% endif %}
{% with card.custom_fields|get:item.template|force_escape as link_label %}
{% if link_label %}
{% if item.link_field %}
{% with fields_by_varnames|get:item.link_field as field and card.fields|get:item.link_field as value %}
{% if field and value and field.type == 'file' %}
<a href="{% make_public_url url=value.url %}"{% if item.display_mode == 'button' %} class="pk-button"{% endif %} download="{{ value.filename }}">{{ link_label }}</a>
{% endif %}
{% endwith %}
{% else %}
{% with item.page|default:item.url_template as url_key %}
{% with card.urls|get:url_key|force_escape as link_url %}
{% if link_url %}
<a href="{{ link_url }}"{% if item.display_mode == 'button' %} class="pk-button"{% endif %}>{{ link_label }}</a>
{% endif %}
{% endwith %}
{% endwith %}
{% endif %}
{% endif %}
{% endwith %}
{% if not ul_display %}</td>{% endif %}
{% endif %}
{% else %}
{% if item.varname %}
{% with fields_by_varnames|get:item.varname as field and card.fields|get:item.varname as value %}
{% if field and value %}
{% if not ul_display %}<td>{% endif %}{% include "combo/wcs/card-field-value.html" with mode='inline' %}{% if not ul_display %}</td>{% endif %}
{% elif field %}
{% if not ul_display %}<td>{% endif %}{% include "combo/wcs/card-field-value.html" with mode='inline' value=item.empty_value empty=True %}{% if not ul_display %}</td>{% endif %}
{% endif %}
{% endwith %}
{% endif %}
{% endif %}
{% endspaceless %}