From e7c97306b79f7d2592a3cc03fcee4ae3c4b2b7e0 Mon Sep 17 00:00:00 2001 From: "pmoreno.rodriguez" Date: Mon, 4 Mar 2024 22:20:37 +0100 Subject: [PATCH] New Downloads template --- templates/downloads.html.twig | 55 ++++++++++++++++++++++ templates/partials/download_item.html.twig | 19 ++++++++ 2 files changed, 74 insertions(+) create mode 100644 templates/downloads.html.twig create mode 100644 templates/partials/download_item.html.twig diff --git a/templates/downloads.html.twig b/templates/downloads.html.twig new file mode 100644 index 0000000..b5c9ddc --- /dev/null +++ b/templates/downloads.html.twig @@ -0,0 +1,55 @@ +{% extends 'partials/base.html.twig' %} + +{% block content %} +
+
+
+

{{ title }}

+ {% if subtitle %} +

{{ subtitle }}

+ {% endif %} +
+
+ + {% if show_image and image %} + + {{ image.cropZoom(img_width, img_height).loading('lazy').attribute('decoding','async').html(title, title)|raw }} + + {% endif %} + + {{ page.content|raw }} + + + + + + + + + + + + + {% for file in page.media.all %} + + {% include 'partials/download_item.html.twig' with {file: file} %} + + {% endfor %} + + +

{{ 'FUTURE.DOWNLOADS.TH_NAME'|t }}

{{ 'FUTURE.DOWNLOADS.TH_SIZE'|t }}

{{ 'FUTURE.DOWNLOADS.TH_MODIFIED'|t }}

{{ 'FUTURE.DOWNLOADS.TH_DOWNLOAD'|t }}

+ +
+ + {% if show_sidebar == false %} + + {% endif %} +{% endblock %} + +{% block sidebar %} +{% if show_sidebar == true %} + {% include 'partials/sidebar_left.html.twig' %} +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/templates/partials/download_item.html.twig b/templates/partials/download_item.html.twig new file mode 100644 index 0000000..c8eb74f --- /dev/null +++ b/templates/partials/download_item.html.twig @@ -0,0 +1,19 @@ +{% set datestamp = include('partials/page-bits/date.html.twig') %} +{% set size = file.size/1024 %} +{% set unit = "Kb" %} +{% if size > 1023 %} + {% set size = size/1024 %} + {% set unit = "Mb" %} +{% endif %} + + {{ file.filename|regex_replace(['/-/','/_/'], [' ',' ']) }} + + + {{ size|number_format(2, '.', ',') }}{{ unit }} + + + {{ datestamp }} + + + {{ 'FUTURE.DOWNLOADS.TD_BUTTON'|t }} +