Browse code

Add opened attribute to downloads to highlight new files

Benjamin Roth authored on09/05/2025 11:18:14
Showing1 changed files
... ...
@@ -5,7 +5,7 @@
5 5
 
6 6
     <ul>
7 7
         {% for file in files %}
8
-            <li class="download-element ext-{{ file.extension }}">
8
+            <li class="download-element ext-{{ file.extension }}{{ file.opened == 0 ? ' new' : '' }}">
9 9
                 {% if file.previews is defined %}
10 10
                     {% for preview in file.previews %}
11 11
                         {{- studio.figure(preview, { attr: { class: ('image_container') }}) -}}
Browse code

Add last modified date to secure download content element listing

Benjamin Roth authored on02/08/2023 12:15:52
Showing1 changed files
... ...
@@ -11,7 +11,7 @@
11 11
                         {{- studio.figure(preview, { attr: { class: ('image_container') }}) -}}
12 12
                     {% endfor %}
13 13
                 {% endif %}
14
-                <a href="{{ file.href }}" title="{{ file.title }}" type="{{ file.mime }}">{{ file.link}} <span class="size">({{ file.filesize }})</span></a>
14
+                <a href="{{ file.href }}" title="{{ file.title }}" type="{{ file.mime }}">{{ file.mtime|date("d.m.Y") }} {{ file.link}} <span class="size">({{ file.filesize }})</span></a>
15 15
             </li>
16 16
         {% endfor %}
17 17
     </ul>
Browse code

Update

Benjamin Roth authored on26/07/2023 21:23:35
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,20 @@
1
+{% extends '@Contao/block_unsearchable' %}
2
+
3
+{% block content %}
4
+    {% import "@ContaoCore/Image/Studio/_macros.html.twig" as studio %}
5
+
6
+    <ul>
7
+        {% for file in files %}
8
+            <li class="download-element ext-{{ file.extension }}">
9
+                {% if file.previews is defined %}
10
+                    {% for preview in file.previews %}
11
+                        {{- studio.figure(preview, { attr: { class: ('image_container') }}) -}}
12
+                    {% endfor %}
13
+                {% endif %}
14
+                <a href="{{ file.href }}" title="{{ file.title }}" type="{{ file.mime }}">{{ file.link}} <span class="size">({{ file.filesize }})</span></a>
15
+            </li>
16
+        {% endfor %}
17
+    </ul>
18
+
19
+{% endblock %}
20
+