update download contents as more files become available

This commit is contained in:
xenofem 2022-05-24 16:49:48 -04:00
parent 007289ffe5
commit be4decde12
4 changed files with 80 additions and 16 deletions

View file

@ -4,10 +4,12 @@
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="css/transbeam.css"/>
<link rel="stylesheet" type="text/css" href="css/download.css"/>
<link rel="apple-touch-icon" href="images/site-icons/transbeam-apple.png"/>
<link rel="manifest" href="manifest.json"/>
<script src="js/util.js"></script>
<script type="text/javascript">
const CODE = "{{ code }}";
</script>
<script src="js/download.js"></script>
<title>{{ file.name }} - transbeam</title>
</head>
@ -25,16 +27,17 @@
{% when Some with (files) %}
<div id="download_contents" class="section">
<h3>Contents</h3>
<table>
<table><tbody>
{% let offsets = offsets.as_ref().unwrap() %}
{% for f in files %}
<tr class="{% if zip::file_data_offset(files.as_ref(), loop.index0.clone()) > available %}unavailable{% endif %}">
<tr class="{% if offsets.get(loop.index0.clone()).unwrap().clone() > 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={{ code }}&download={{ loop.index0 }}"></a></td>
<td class="file_unavailable"></td>
</tr>
{% endfor %}
</table>
</tbody></table>
</div>
{% else %}
{% endmatch %}