{# Properties page for a single ir.attachment. Renders in two modes: * Full page (default) — wraps in the standard sidebar layout. * Panel fragment (is_panel=True) — used by the Library's right-side slide-over. Skips the layout, omits the page heading, and lays the preview + metadata vertically so it fits a narrow column. Context variables (set by the route handler): att ir.attachment record (already permission-checked) mimetype lowercased att.mimetype is_image bool — image MIME → render preview extension derived from datas_fname / name (lowercase, no dot) dimensions (w, h) tuple or None — only computed for images owner_url /web/records/.../ link or "" when no owner folder_chain [{id, name}, …] root → leaf, or [] panel_only bool — skip the page chrome #} {% if not panel_only %}{% extends "layouts/main.html" %}{% endif %} {% if not panel_only %} {% block title %}{{ att.name }} — {% if brand is defined %}{{ brand.app_name }}{% else %}pyvelm{% endif %}{% endblock %} {% block page_title %}{{ att.name }}{% endblock %} {% block page_actions %} Download {% if owner_url %} Open linked record {% endif %} {% endblock %} {% endif %} {% if panel_only %} {% set body_class = "space-y-3" %} {% else %} {% set body_class = "grid gap-6 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_28rem]" %} {% endif %} {% set body %}
{# ─── Preview ─── #}
{% if is_image %} {{ att.name }} {% else %}
{{ extension or 'file' }}
{% endif %}
{# ─── Metadata + actions ─── #}
{% if panel_only %}

{{ att.name }}

{% endif %} {% if folder_chain %} {% endif %}
Name
{{ att.name }}
Filename
{{ att.datas_fname or '—' }}
Type
{{ mimetype or 'application/octet-stream' }}
Size
{{ att.file_size | human_size }}
{% if is_image and dimensions %}
Dimensions
{{ dimensions[0] }} × {{ dimensions[1] }} px
{% elif is_image %}
Dimensions
{% endif %}
Created
{{ att.created_at or '—' }}
Updated
{{ att.updated_at or '—' }}
{% if att.res_model %}
Linked to
{% if owner_url %} {{ att.res_model }} #{{ att.res_id }} {% else %} {{ att.res_model }}{% if att.res_id %} #{{ att.res_id }}{% endif %} {% endif %}
{% endif %}
Storage
{% if att.type == 'url' %} External URL {% elif att.storage_key %} Local backend {% else %} Inline (DB) {% endif %}
Public
{% if panel_only %} {% endif %}
{% endset %} {% if panel_only %} {{ body }} {% else %} {% block content %}{{ body }}{% endblock %} {% endif %}