transbeam/templates/download.html

54 lines
2.2 KiB
HTML
Raw 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 -%}
{% let formatted_total_size = bytesize::to_string(info.file.size.clone(), false).replace(" ", "") -%}
{% 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>
<div class="file_size">{{ bytesize::to_string(info.file.size.clone(), false).replace(" ", "") }}</div>
<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 %}">
<td class="file_size">{{ bytesize::to_string(f.size.clone(), false).replace(" ", "") }}</td>
<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 %}