{#- A document: what it is, its preview and what to do with it; beside it, the comments on it, its history and, for the community's managers, who has read it. A button gives the document the whole width. Drawn in `mockups/templates/document.html`. -#} {% extends "ads_community.html" %} {% import "documents/_dialogs.html" as dialogs with context %} {% set doc_kw = {"community_id": g.community.slug, "doc_id": doc.id} %} {% block page_title %}{{ doc.title }} · {{ _("Documents") }} · {{ g.community.name }}{% endblock %} {% block content %}
{#- The document, and what to do with it: download first; a new version and the lock, which working together depends on, in sight; the rest behind ⋮. -#}
    {% for crumb in breadcrumbs[:-1] %}
  1. {{ crumb.label }}
  2. {% endfor %}

{{ file_icon(doc.title) }}{{ doc.title }}

{{- doc.content_length | filesize }} {%- if doc.page_num and doc.page_num > 1 %} · {{ ngettext("%(num)d page", "%(num)d pages", doc.page_num) }}{% endif %} · {{ m.avatar(doc.creator, "ads-avatar--xs") }}{{ m.time(doc.created_at) }} {%- if doc_comments %} · {{ ngettext("%(num)d comment", "%(num)d comments", doc_comments | length) }}{% endif -%}
{% if doc.antivirus_ok %} {{ icon("download") }}{{ _("Download") }} {% endif %} {% if may_replace %} {% endif %} {% if may_write and not lock %}
{{ csrf.field() }}
{% endif %} {% if may_write or may_manage %}
{{ icon("dots-vertical") }}
{% if may_write %} {% if doc.antivirus_ok %}{% endif %} {% endif %} {% if may_manage and doc.antivirus_ok %}{{ icon("refresh") }}{{ _("Refresh preview") }}{% endif %} {% if may_write %}
{% endif %}
{% endif %}
{% if doc.antivirus_required %}
{{ icon("clock") }}{{ _("Waiting for virus check...") }}
{% elif not doc.antivirus_ok %} {% endif %} {% if lock %}
{{ icon("lock") }}{{ _("Locked by %(user)s, who is working on it (%(age)s).", user=lock.user, age=lock.date | age) }} {% if may_unlock %}
{{ csrf.field() }}
{% endif %}
{% endif %} {% if doc.description %}

{{ doc.description }}

{% endif %} {% if doc.antivirus_ok %}
{% if has_preview and doc.page_num and doc.page_num > 1 %} {{ _("Page") }} 1 / {{ doc.page_num }} {% endif %} {#- A checkbox drawn as a button: the page hides the column when it is ticked (`:has()`), with no script. -#}
{#- An image is its own preview. -#}
{% if has_preview or doc.content_type.startswith("image/") %} {{ _('Preview of %(name)s', name=doc.title) }} {% else %}

{{ _("Document preview not yet available") }}

{% endif %}
{% endif %}
{#- The move dialog moves the folder listing's selection: here, this document. -#} {% endblock %} {% block overlays %} {% for c in doc_comments %} {% if c.id in editable_comments %}
{{ csrf.field() }}
{% endif %} {% if c.id in deletable_comments %}
{{ csrf.field() }}
{{ _("This cannot be undone.") }}
{% endif %} {% endfor %} {% if may_write %} {{ dialogs.document_dialogs(doc) }} {{ dialogs.move_dialog(doc.parent) }}
{{ csrf.field() }}

{{ _("Delete “%(name)s”?", name=doc.title) }}

{{ _("It goes for everyone in the community. This cannot be undone.") }}
{% endif %} {% endblock %}