the_works/the_works/templates/views/text.html

60 lines
2.1 KiB
HTML

{% extends 'base.html' %}
{% set SPLIT_CHARACTER = "|" %}
{% block title %}Texte{% endblock title %}
{% block script %}
<script>
window.onload = function () {
// initialise DataTable
let table = new DataTable('#text-table', {
paging: false,
order: []
});
deRole("#text-table");
// create and append "New"-button to
let a = document.createElement("a");
a.id = "create-button";
a.setAttribute("title", "Text hinzufügen");
a.setAttribute("role", "button");
a.setAttribute("href", "{{ url_for('text.read', id=0) }}"); // there's no DB entry with id = 0, therefore the backend knows to serve an empty form
a.innerHTML = "Neu …";
document.getElementById("text-table_wrapper").firstElementChild.firstElementChild.appendChild(a);
}
</script>{% endblock script %}
{% block heading %}Texte{% endblock heading %}
{% block content %}
{% include "_icons.svg" %}
<table id="text-table">
<thead>
<tr>
<th>Titel</th>
<th>Untertitel</th>
<th>Reihe</th>
<th>Textform</th>
<th>Sprache</th>
<th>Genres</th>
<th colspan="2">Aktionen</th>
</tr>
</thead>
<tbody>
{% for text in texte %}
<tr id="text-{{ text['id'] }}">
<td title="Titel">{{ text["Titel"] }}</td>
<td title="Untertitel">{{ text["Untertitel"] }}</td>
<td title="Reihe">{{ text["Reihe"] }}</td>
<td title="Textform">{{ text["Textform"] }}</td>
<td title="Sprache">{{ text["Sprache"] }}</td>
<td title="Genres">{{ text["Genre_list"] | join(SPLIT_CHARACTER) }}</td>
<td class="action action-update" data-id="{{ text['id'] }}"><a href="{{ url_for('text.read', id=text['id']) }}" title="Text ansehen/bearbeiten"><svg viewbox="0 0 24 24"><use href="#update" /></svg></a></td>
<td id="delete-{{ text['id'] }}" class="action"><a onclick="return confirm('Eintrag wirklich löschen?');" href="{{ url_for('text.delete', id=text['id']) }}" title="Text löschen"><svg viewbox="0 0 24 24"><use href="#delete" /></svg></a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}