transbeam/templates/download.html

54 lines
2.1 KiB
HTML
Raw Permalink Normal View History

2022-05-26 14:43:03 -04:00
{% extends "base.html" %}
{% block title %}{{ info.file.name }} - transbeam{% endblock %}
{% block og_title %}{{ info.file.name }}{% endblock %}
{% block og_description -%}
2022-11-10 12:41:51 -05:00
{% let formatted_total_size = info.file.formatted_size() -%}
{% match info.file.contents -%}
{% when Some with (files) -%}
{{ files.files.len() }} files, {{ formatted_total_size }} total
{%- else -%}
{{ formatted_total_size }}
{%- endmatch %}, expires {{ info.file.expiry.format(DATE_DISPLAY_FORMAT).unwrap() }}
{%- endblock %}
{% block relative_path %}download?code={{ info.code }}{% endblock %}
2022-05-26 14:43:03 -04:00
{% block head %}
<script src="js/util.js?{{ cachebuster }}"></script>
<script type="text/javascript">
const CODE = "{{ info.code }}";
</script>
<script src="js/download.js?{{ cachebuster }}"></script>
{% endblock %}
{% block body %}
<div id="download_toplevel" class="section">
<div class="file_name">{{ info.file.name }}</div>
2022-11-10 12:41:51 -05:00
<div class="file_size">{{ info.file.formatted_size() }}</div>
2022-05-26 14:43:03 -04:00
<div class="file_download"><a class="download_button" href="download?code={{ info.code }}&download=all"></a></div>
2022-05-26 15:09:37 -04:00
<div class="file_expiry">Expires {{ info.file.expiry.format(DATE_DISPLAY_FORMAT).unwrap() }}</div>
2022-05-26 14:43:03 -04:00
</div>
{% match info.file.contents %}
{% when Some with (files) %}
<div id="download_contents" class="section">
<details>
<summary>Show file list</summary>
<table><tbody>
{% let offsets = info.offsets.as_ref().unwrap() %}
{% for f in files.files %}
2022-05-26 14:43:03 -04:00
<tr class="{% if offsets.get(loop.index0.clone()).unwrap().clone() > info.available %}unavailable{% endif %}">
2022-11-10 12:41:51 -05:00
<td class="file_size">{{ f.formatted_size() }}</td>
2022-05-26 14:43:03 -04:00
<td class="file_name">{{ f.name }}</td>
<td class="file_download"><a class="download_button" href="download?code={{ info.code }}&download={{ loop.index0 }}"></a></td>
<td class="file_unavailable"></td>
</tr>
{% endfor %}
</tbody></table>
</details>
</div>
{% else %}
{% endmatch %}
{% endblock %}