mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-06-07 11:58:53 +00:00
New Downloads template
This commit is contained in:
parent
4e77fe7d49
commit
e7c97306b7
2 changed files with 74 additions and 0 deletions
55
templates/downloads.html.twig
Normal file
55
templates/downloads.html.twig
Normal file
|
@ -0,0 +1,55 @@
|
|||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<article class="post">
|
||||
<header>
|
||||
<div class="title">
|
||||
<h1>{{ title }}</h1>
|
||||
{% if subtitle %}
|
||||
<p>{{ subtitle }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% if show_image and image %}
|
||||
<span class="image featured">
|
||||
{{ image.cropZoom(img_width, img_height).loading('lazy').attribute('decoding','async').html(title, title)|raw }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{{ page.content|raw }}
|
||||
|
||||
<table class="responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><h3>{{ 'FUTURE.DOWNLOADS.TH_NAME'|t }}</h3></th>
|
||||
<th><h3>{{ 'FUTURE.DOWNLOADS.TH_SIZE'|t }}</h3></th>
|
||||
<th><h3>{{ 'FUTURE.DOWNLOADS.TH_MODIFIED'|t }}</h3></th>
|
||||
<th><h3>{{ 'FUTURE.DOWNLOADS.TH_DOWNLOAD'|t }}</h3></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{% for file in page.media.all %}
|
||||
<tr>
|
||||
{% include 'partials/download_item.html.twig' with {file: file} %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</article>
|
||||
|
||||
{% if show_sidebar == false %}
|
||||
<section id="footer" class="align-center">
|
||||
{% include 'partials/sidebar-bits/footer.html.twig' %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% if show_sidebar == true %}
|
||||
{% include 'partials/sidebar_left.html.twig' %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
19
templates/partials/download_item.html.twig
Normal file
19
templates/partials/download_item.html.twig
Normal file
|
@ -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 %}
|
||||
<td>
|
||||
{{ file.filename|regex_replace(['/-/','/_/'], [' ',' ']) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ size|number_format(2, '.', ',') }}{{ unit }}
|
||||
</td>
|
||||
<td>
|
||||
{{ datestamp }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ file.url }}" class="button small" download>{{ 'FUTURE.DOWNLOADS.TD_BUTTON'|t }}</a>
|
||||
</td>
|
Loading…
Add table
Reference in a new issue