Make FileLink filetype editable

This commit is contained in:
Bart Schuurmans 2024-03-12 14:32:58 +01:00
parent 38e39ad870
commit 0630e34973

View file

@ -32,12 +32,18 @@
<th>{% trans "URL" %}</th>
<th>{% trans "Added by" %}</th>
<th>{% trans "Filetype" %}</th>
<th>{% trans "Availability" %}</th>
<th>{% trans "Domain" %}</th>
<th>{% trans "Status" %}</th>
<th colspan="2">{% trans "Actions" %}</th>
</tr>
{% for link in links %}
<tr>
<form name="edit-link-{{ link.id }}" class="control" method="post" action="{% url 'file-link' book.id link.id %}">
{% csrf_token %}
<input type="hidden" name="url" value="{{ link.form.url.value }}">
<input type="hidden" name="added_by" value="{{ link.form.added_by.value }}">
<input type="hidden" name="book" value="{{ link.form.book.value }}">
<td class="overflow-wrap-anywhere">
<a href="{{ link.url }}" target="_blank" rel="nofollow noopener noreferrer">{{ link.url }}</a>
</td>
@ -49,7 +55,20 @@
{% endif %}
</td>
<td>
{{ link.filelink.filetype }}
<div class="field">
<div class="control">
{{ link.form.filetype }}
</div>
</div>
</td>
<td>
<div class="field">
<div class="control">
<div class="select">
{{ link.form.availability }}
</div>
</div>
</div>
</td>
<td>
{{ link.domain.name }}
@ -70,25 +89,14 @@
{% endwith %}
</td>
<td>
<form name="edit-link" class="control" method="post" action="{% url 'file-link' book.id link.id %}">
{% csrf_token %}
<input type="hidden" name="url" value="{{ link.form.url.value }}">
<input type="hidden" name="filetype" value="{{ link.form.filetype.value }}">
<input type="hidden" name="added_by" value="{{ link.form.added_by.value }}">
<input type="hidden" name="book" value="{{ link.form.book.value }}">
<div class="field has-addons">
<div class="control">
<div class="select">
{{ link.form.availability }}
</div>
</div>
<div class="field">
<div class="control">
<button class="button is-primary" type="submit">{% trans "Save" %}</button>
</div>
</div>
{% include 'snippets/form_errors.html' with errors_list=link.form.availability.errors id="desc_availability" %}
</form>
</td>
</form>
<td>
<form name="delete-link-{{ link.id }}" class="control" method="post" action="{% url 'file-link-delete' book.id link.id %}">
{% csrf_token %}
@ -99,7 +107,7 @@
{% endfor %}
{% if not book.file_links.exists %}
<tr>
<td colspan="5"><em>{% trans "No links available for this book." %}</em></td>
<td colspan="8"><em>{% trans "No links available for this book." %}</em></td>
</tr>
{% endif %}
</table>