Les favoris sont désormais conservés lorsqu'on change de date.
Amélioration de la disposition des boutons.
This commit is contained in:
parent
f2c1d2d7f5
commit
17df0e900c
16
app.py
16
app.py
@ -149,7 +149,7 @@ def free_rooms() :
|
||||
|
||||
# Récupére les IDs des salles favorites
|
||||
favs_ids = request.args.getlist("favs")
|
||||
if favs_ids==None:
|
||||
if favs_ids == None:
|
||||
favs_ids = []
|
||||
|
||||
date = dti.datetime.now()
|
||||
@ -168,7 +168,8 @@ def free_rooms() :
|
||||
# Récupération de la liste des départements :
|
||||
dept_filen = "data/dept_list.txt"
|
||||
dept_list = ro.get_depts(dept_filen)
|
||||
# Vérifie qu'il n'y a pas de mauvais départements demandés
|
||||
|
||||
# Vérifie qu'il n'y a pas de mauvais départements demandés :
|
||||
for d in dident_list:
|
||||
try:
|
||||
int(d)
|
||||
@ -211,6 +212,14 @@ def free_rooms() :
|
||||
|
||||
change_date_str = "?"
|
||||
i = 0
|
||||
if favs_ids != [] :
|
||||
i = 0
|
||||
for f in favs_ids :
|
||||
change_date_str += "favs=" + str(f)
|
||||
if i < len(favs_ids) - 1:
|
||||
change_date_str += "&"
|
||||
i+=1
|
||||
change_date_str += "&"
|
||||
for v in dident_list:
|
||||
change_date_str += "dept="+str(v)
|
||||
if i<len(dident_list)-1:
|
||||
@ -266,8 +275,9 @@ def date_select() :
|
||||
flask.render_template
|
||||
"""
|
||||
dident_list = request.args.getlist("dept")
|
||||
favs_ids = request.args.getlist("favs")
|
||||
|
||||
context = {"dident_list":dident_list}
|
||||
context = {"dident_list":dident_list, "favs_ids":favs_ids}
|
||||
|
||||
return render_template("date-select.html", **context, **GLOBAL_CONTEXT)
|
||||
|
||||
|
@ -23,6 +23,9 @@
|
||||
{% for d in dident_list : %}
|
||||
<span style="display: none;"><input type="text" name="dept" value="{{ d }}"/></span>
|
||||
{% endfor %}
|
||||
{% for f in favs_ids : %}
|
||||
<span style="display: none;"><input type="text" name="favs" value="{{ f }}"/></span>
|
||||
{% endfor %}
|
||||
</form>
|
||||
</main>
|
||||
{% include "footer.html" %}
|
||||
|
@ -20,16 +20,16 @@
|
||||
<b>Le {{ date_str }}</b>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="flex" style="margin: 10px">
|
||||
<a class="button" href='/app/date-select{{change_date_str}}'>Choisir une date</a>
|
||||
</div>
|
||||
{% if favs: %}
|
||||
<div class="flex">
|
||||
<div class="flex" style="margin: 10px">
|
||||
<a class="button" href="{{ nofavslink }}">Retirer les favoris</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<form action="/app/free-rooms" method="get">
|
||||
<div class="flex" style="margin: 20px">
|
||||
<div class="flex" style="margin: 10px">
|
||||
<input style="font-size: 16px;" type="submit" value="Enregistrer les favoris">
|
||||
</div>
|
||||
{% if favs: %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user