added modal dialog with prepopulated selects
This commit is contained in:
parent
b75f96e4b0
commit
83fe0e949a
@ -5,6 +5,11 @@
|
|||||||
{% block heading %}Texte{% endblock heading %}
|
{% block heading %}Texte{% endblock heading %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<article>
|
||||||
|
<section>
|
||||||
|
<button commandfor="textmodal" command="show-modal" onclick="textmodal.showModal()">Neuer Text …</button>
|
||||||
|
</section>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -27,4 +32,51 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<dialog aria-labelledby="dialog-heading" id="textmodal">
|
||||||
|
<article>
|
||||||
|
<header>
|
||||||
|
<button aria-label="close" rel="prev" onclick="textmodal.close()"></button>
|
||||||
|
<h1 id="dialog-heading">Neuer Text</h1>
|
||||||
|
</header>
|
||||||
|
<form>
|
||||||
|
<label>
|
||||||
|
Titel (erforderlich)
|
||||||
|
<input name="text_titel" placeholder="Titel" required />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Untertitel
|
||||||
|
<input name="text_untertitel" placeholder="Untertitel" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Reihe
|
||||||
|
<select name="text_reihe" aria-label="Der Text gehört zur Reihe …">
|
||||||
|
<option selected value="">keine Reihe</option>
|
||||||
|
{% for r in reihen %}<option value="{{ r['ID'] }}">{{ r['Reihentitel']}}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Textform (erforderlich)
|
||||||
|
<select name="text_textform" aria-label="Textform" required>
|
||||||
|
<option selected disabled value="">Textform auswählen …</option>
|
||||||
|
{% for tf in textformen %}<option value="{{ tf['ID'] }}">{{ tf['Textform']}}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Sprache (erforderlich)
|
||||||
|
<select name="text_sprache" aria-label="Sprache des Textes" required>
|
||||||
|
<option selected disabled value="">Sprache auswählen …</option>
|
||||||
|
{% for s in sprachen %}<option value="{{ s['ID'] }}">{{ s['Sprache']}}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<button type="submit" formmethod="post" formaction="">OK</button>
|
||||||
|
<button aria-label="close" formmethod="dialog" formnovalidate>Abbrechen</button>
|
||||||
|
</form>
|
||||||
|
</article>
|
||||||
|
</dialog>
|
||||||
|
|
||||||
|
</article>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
@ -8,7 +8,7 @@ def home():
|
|||||||
return render_template("views/home.html")
|
return render_template("views/home.html")
|
||||||
|
|
||||||
@bp.route("/texte")
|
@bp.route("/texte")
|
||||||
def texte():
|
def texte_list():
|
||||||
db = get_db()
|
db = get_db()
|
||||||
rows = db.execute(
|
rows = db.execute(
|
||||||
"""SELECT
|
"""SELECT
|
||||||
@ -22,4 +22,8 @@ def texte():
|
|||||||
LEFT JOIN Textformen f ON t.Textform = f.ID
|
LEFT JOIN Textformen f ON t.Textform = f.ID
|
||||||
LEFT JOIN Sprachen s ON t.Originalsprache = s.ID;"""
|
LEFT JOIN Sprachen s ON t.Originalsprache = s.ID;"""
|
||||||
).fetchall()
|
).fetchall()
|
||||||
return render_template("views/texte.html", rows=rows)
|
reihen = db.execute("SELECT ID, Reihentitel from Reihen").fetchall()
|
||||||
|
textformen = db.execute("SELECT ID, Textform from Textformen").fetchall()
|
||||||
|
sprachen = db.execute("SELECT ID, Sprache from Sprachen").fetchall()
|
||||||
|
return render_template("views/texte.html", rows=rows, reihen=reihen, textformen=textformen, sprachen=sprachen)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user