]> Raphaël G. Git Repositories - treebundle/commitdiff
Add album and element templates
authorRaphaël Gertz <git@rapsys.eu>
Thu, 14 Nov 2024 07:53:16 +0000 (08:53 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 14 Nov 2024 07:53:16 +0000 (08:53 +0100)
templates/album.html.twig [new file with mode: 0644]
templates/element.html.twig [new file with mode: 0644]

diff --git a/templates/album.html.twig b/templates/album.html.twig
new file mode 100644 (file)
index 0000000..114cf80
--- /dev/null
@@ -0,0 +1,58 @@
+{% extends '@RapsysTree/_base.html.twig' %}
+{% block content %}
+       {% if album is defined and album %}
+               <article>
+                       <header>
+                               <h2>
+                                       {% for breadcrumb in album.breadcrumbs %}
+                                               <a href="{{ breadcrumb.link }}">{{ breadcrumb.name }}</a>
+                                       {% endfor %}
+                               </h2>
+                               {% if album.elements is defined and album.elements %}
+                                       <ul>
+                                               {% if album.elements is defined and album.elements %}
+                                                       {% for eid, element in album.elements %}
+                                                               <li><a href="{{ element.link }}">{{ element.name }}</a></li>
+                                                       {% endfor %}
+                                               {% endif %}
+                                       </ul>
+                               {% endif %}
+                       </header>
+                       <section>
+                               {% if ( album.directories is defined and album.directories ) or ( album.files is defined and album.files ) %}
+                                       <ul>
+                                               {% if album.directories is defined and album.directories %}
+                                                       {% for name, link in album.directories %}
+                                                               <li><a href="{{ link }}">{{ name }}</a></li>
+                                                       {% endfor %}
+                                               {% endif %}
+                                               {% if album.files is defined and album.files %}
+                                                       {% for name, infos in album.files %}
+                                                               <li><a href="{{ infos.link }}">{{ name }}</a></li>
+                                                       {% endfor %}
+                                               {% endif %}
+                                       </ul>
+                               {% endif %}
+                               {% if album.file is defined and album.file %}
+                                       <dl>
+                                               <dt>{% trans %}Size{% endtrans %}</dt>
+                                               <dd title="{{ album.file.size }}">{{ album.file.intlsize }} {{ album.file.intlunit }}</dd>
+                                       </dl>
+                                       <dl>
+                                               <dt>{% trans %}Mime type{% endtrans %}</dt>
+                                               <dd>{{ album.file.mimetype }}</dd>
+                                       </dl>
+                                       {% if album.file.thumb is defined and album.file.thumb %}
+                                               <dl>
+                                                       <dt>{% trans %}Thumb{% endtrans %}</dt>
+                                                       <dd>
+                                                               <a href=""><img src="{{ album.file.thumb.src }}" alt="{{ album.file.name }}" width="{{ album.file.thumb.width }}" height="{{ album.file.thumb.height }}" /></a>
+                                                       </dd>
+                                               </dl>
+                                       {% endif %}
+                               {% endif %}
+                       </section>
+               </article>
+               {# TODO: XXX: add next, prev and parent links ? #}
+       {% endif %}
+{% endblock %}
diff --git a/templates/element.html.twig b/templates/element.html.twig
new file mode 100644 (file)
index 0000000..1996c3b
--- /dev/null
@@ -0,0 +1,47 @@
+{% extends '@RapsysTree/_base.html.twig' %}
+{% block content %}
+       {% if element is defined and element %}
+               <article>
+                       <header>
+                               <h2>
+                                       {% for breadcrumb in element.breadcrumbs %}
+                                               <a href="{{ breadcrumb.link }}">{{ breadcrumb.name }}</a>
+                                       {% endfor %}
+                               </h2>
+                       </header>
+                       <section>
+                               {% if ( element.directories is defined and element.directories ) or ( element.files is defined and element.files ) %}
+                                       <ul>
+                                               {% if element.directories is defined and element.directories %}
+                                                       {% for name, link in element.directories %}
+                                                               <li><a href="{{ link }}">{{ name }}</a></li>
+                                                       {% endfor %}
+                                               {% endif %}
+                                               {% if element.files is defined and element.files %}
+                                                       {% for name, infos in element.files %}
+                                                               <li><a href="{{ infos.link }}">{{ name }}</a></li>
+                                                       {% endfor %}
+                                               {% endif %}
+                                       </ul>
+                               {% endif %}
+                               {% if element.file is defined and element.file %}
+                                       <dl>
+                                               <dt>{% trans %}Size{% endtrans %}</dt>
+                                               <dd title="{{ element.file.size }}">{{ element.file.intlsize }} {{ element.file.intlunit }}</dd>
+                                       </dl>
+                                       <dl>
+                                               <dt>{% trans %}Mime type{% endtrans %}</dt>
+                                               <dd>{{ element.file.mimetype }}</dd>
+                                       </dl>
+                                       {% if element.file.preview is defined and element.file.preview %}
+                                               <dl>
+                                                       <dt>{% trans %}Preview{% endtrans %}</dt>
+                                                       <dd>element.file.preview</dd>
+                                               </dl>
+                                       {% endif %}
+                               {% endif %}
+                       </section>
+               </article>
+               {# TODO: XXX: add next, prev and parent links ? #}
+       {% endif %}
+{% endblock %}