parcel/templates/uploads/page.html
Blake Rain e0de6def5a
Some checks failed
Check / check (push) Failing after 53s
Deploy / build (push) Failing after 1m53s
feat: add password protection to public uploads (closes #12, closes #15)
2024-08-13 14:17:24 +01:00

103 lines
3.5 KiB
HTML

{% for upload in uploads %}
<tr
id="upload-row-{{ upload.id }}"
{% if loop.index == (uploads | length) and page < last_page %}
hx-trigger="revealed"
hx-get="/uploads/list/{{ page + 1 }}?order={{ query.order }}&asc={{ query.asc }}"
hx-target="#upload-list tbody"
hx-swap="beforeend"
{% endif %}>
<td class="slim text-center">
<parcel-grouped-checkbox
name="selected"
group="uploads"
value="{{ upload.id }}">
</parcel-grouped-checkbox>
</td>
<td>
<div class="flex flex-row gap-1">
<a class="truncate" href="/uploads/{{ upload.slug }}">{{ upload.filename }}</a>
<parcel-clipboard url="true" value="/uploads/{{ upload.slug }}"></parcel-clipboard>
</div>
</td>
<td class="text-right text-nowrap hidden md:table-cell">{{ upload.size | filesizeformat }}</td>
<td class="text-right text-nowrap hidden xl:table-cell">{{ upload.downloads }}</td>
<td class="text-right text-nowrap hidden lg:table-cell {% if upload.remaining is number and upload.remaining == 0 %}text-danger{% endif %}">
{% if upload.limit is number %}
{% if upload.remaining is number and upload.remaining < upload.limit %}
<a
href="#"
title="Reset remaining downloads to {{ upload.limit }}"
hx-post="/uploads/{{ upload.id }}/reset"
hx-trigger="click"
hx-target="closest td"
hx-swap="outerHTML"
hx-confirm="Are you sure you want to reset the remaining downloads for this upload?">
<span class="icon-rotate-ccw"></span>
</a>
{% endif %}
{{ upload.remaining | default(value = upload.limit) }} / {{ upload.limit }}
{% else -%}
&#8734;
{%- endif %}
</td>
<td class="text-nowrap hidden lg:table-cell {% if upload.expiry_date and upload.expiry_date is past %}text-danger{% endif %}">
{% if upload.expiry_date %}
<span class="hidden xl:block">
<parcel-date value="{{ upload.expiry_date | date }}">
{{ upload.expiry_date | date }}
</parcel-date>
({{ upload.expiry_date | datetime_offset }})
</span>
<span class="block xl:hidden">
{{ upload.expiry_date | datetime_offset }}
</span>
{% endif %}
</td>
<td class="text-center text-nowrap {% if upload.public %}text-danger{% endif %}">
{% if upload.public %}
Yes
{% else %}
No
{% endif %}
</td>
<td class="text-left text-nowrap hidden xl:table-cell">
<parcel-datetime value="{{ upload.uploaded_at | datetime }}">
{{ upload.uploaded_at | datetime }}
</parcel-datetime>
</td>
<td class="text-right whitespace-nowrap">
<a href="/uploads/{{ upload.slug }}/download" title="Download {{ upload.filename }}">
<span class="icon-download"></span>
</a>
<a
href="#"
title="Edit upload settings"
hx-get="/uploads/{{ upload.id }}/edit"
hx-trigger="click"
hx-target="body"
hx-swap="beforeend">
<span class="icon-pencil"></span>
</a>
<a
href="#"
title="Delete upload"
hx-delete="/uploads/{{ upload.id }}"
hx-trigger="click"
hx-target="closest tr"
hx-swap="outerHTML swap:0.5s"
hx-confirm="Are you sure you want to delete this upload?">
<span class="icon-trash-2"></span>
</a>
</td>
</tr>
{% endfor %}