{% extends "_base.html" %} {% set ptitle = data['properties'][data['title_field']] or ("Item {}".format(data['id'])) %} {# Optionally renders an img element, otherwise standard value or link rendering #} {% macro render_item_value(v, width) -%} {% set val = v | string | trim %} {% if val|length and val.lower().endswith(('.jpg', '.jpeg', '.png', '.gif', '.bmp')) %} {# Ends with image extension: render img element with link to image #} {{ val.split('/') | last }} {% elif v is string or v is number %} {{ val | urlize() }} {% elif v is mapping %} {% for i,j in v.items() %} {{ i }}: {{ render_item_value(j, 60) }}
{% endfor %} {% elif v is iterable %} {% for i in v %} {{ render_item_value(i, 60) }} {% endfor %} {% else %} {{ val | urlize() }} {% endif %} {%- endmacro %} {% block title %}{{ ptitle }} - {{ super() }}{% endblock %} {% block crumbs %}{{ super() }} / Collections {% for link in data['links'] %} {% if link.rel == 'collection' %} / {{ link['title'] | truncate( 25 ) }} {% endif %} {% endfor %} / Items / {{ ptitle | truncate( 25 ) }} {% endblock %} {% block extrahead %} {% endblock %} {% block body %}

{{ ptitle }}

{% if data['prev'] or data['next'] %}
{% for link in data['links'] %} {% if link['rel'] == 'prev' %} Previous {% elif link['rel'] == 'next' %} Next {% endif %} {% endfor %}
{% endif %}
{% for k, v in data['properties'].items() %} {% if k != data['id_field'] %} {% if k in ['links', 'associations'] %} {% else %} {% endif %} {% endif %} {% endfor %}
Property Value
id {{ data.id }}
{{ k }} {{ render_item_value(v, 80) }}
{% endblock %} {% block extrafoot %} {% endblock %}