the_works/the_works/templates/views/genre.html
eclipse 1887cc406b streamlined behavior of form modal on different events:
- enter key
- escape key
- click close button
- click submit button
- click cancel button
- click outside of modal

note: right now the corrections only affect genre.html; changes will need to be carried over to other templates
2025-06-03 11:24:34 +02:00

71 lines
2.5 KiB
HTML

{% extends 'base.html' %}
{% block title %}Genres{% endblock title %}
{% block head %}
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/datatables.css') }}">
{% endblock head %}
{% block heading %}Genres{% endblock heading %}
{% block content %}
{% include "_icons.svg" %}
<table id="genre-table">
<thead>
<tr>
<th>Genre</th>
<th colspan="2">Aktionen</th>
</tr>
</thead>
<tbody>
{% for genre in genres %}
<tr id="genre-{{ genre['ID'] }}">
<td title="Genre">{{ genre["Genre"] }}</td>
<td class="action action-update" data-id="{{ genre['ID'] }}" data-genre="{{genre['Genre'] }}"><a href="#" title="Genre bearbeiten"><svg viewbox="0 0 24 24"><use href="#update" /></svg></a></td>
<td id="delete-{{ genre['ID'] }}" class="action"><a onclick="return confirm('Eintrag wirklich löschen?');" href="{{ url_for('genre.delete', id=genre['ID']) }}" title="Genre löschen"><svg viewbox="0 0 24 24"><use href="#delete" /></svg></a></td>
</tr>
{% endfor %}
</tbody>
</table>
<dialog aria-labelledby="dialog-heading" id="genre-modal">
<article>
<form id="genre_detail_form" method="post" action="{{ url_for('genre.create') }}">
<header>
<button class="modal-close" aria-label="close" formmethod="dialog" formnovalidate rel="prev"></button>
<h1 id="dialog-heading" />
</header>
<fieldset>
<article>
<label>
<span class="required">Genre</span>
<input id="form_Genre" name="form_Genre" aria-Label="Genre" required autofocus />
</label>
</article>
</fieldset>
<footer class="grid">
<button id="form_submit" type="submit" formmethod="post" formaction="{{ url_for('genre.create') }}">OK</button>
<button class="secondary" aria-label="close" formmethod="dialog" formnovalidate>Abbrechen</button>
</footer>
</form>
</article>
</dialog>
{% endblock content %}
{% block script %}
<script src="{{ url_for('static', filename='js/datatables.js') }}"></script>
<script src="{{ url_for('static', filename='js/init_dt.js') }}"></script>
<script src="{{ url_for('static', filename='js/modal.js') }}"></script>
<script>
window.onload = function () {
initDataTable("genre-table");
initCreateButton("genre-table", "Genre hinzufügen …");
initModal("genre-modal", "form_Genre", ["Neues Genre", "Genre bearbeiten"], ["{{ url_for('genre.create') }}", "{{ url_for('genre.update', id=-1) }}"]);
}
</script>
{% endblock script %}