* #134 render item attr image URL as image thumb element * #134 render item attr image URL as image thumb element - dont use macros include
This commit is contained in:
committed by
GitHub
parent
a49dbda4aa
commit
5be1126080
@@ -1,4 +1,17 @@
|
||||
{% extends "base.html" %}
|
||||
{# Optionally renders an img element, otherwise standard value or link rendering #}
|
||||
{% macro render_item_value(v, width) -%}
|
||||
{% set val = v | string | trim | lower %}
|
||||
{% if val|length and
|
||||
(val.endswith(".jpg") or val.endswith(".jpeg") or val.endswith(".png") or val.endswith(".gif") or val.endswith(".bmp"))
|
||||
%}
|
||||
{# Ends with image extension: render img element with link to image #}
|
||||
<a href="{{ val }}"><img src="{{ val }}" alt="" width="{{ width }}"/></a>
|
||||
{% else %}
|
||||
{# All other cases: text or link value #}
|
||||
{{ v | urlize() }}
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
{% block title %}{{ super() }} {{ data['title'] }} {% endblock %}
|
||||
{% block crumbs %}{{ super() }}
|
||||
/ <a href="../../../collections">Collections</a>
|
||||
@@ -52,7 +65,7 @@
|
||||
</ul>
|
||||
</td>
|
||||
{% else %}
|
||||
<td>{{ v | urlize(25) }}</td>
|
||||
<td>{{ render_item_value(v, 80) }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user