ludo/templates/index.html
2022-04-03 14:19:54 +02:00

82 lines
2.6 KiB
HTML

{% extends "master.html" %}
{% block main %}
{% if session.logged %}
<div class="new_roll">
<h3>Nouveau tirage :</h3>
{% with messages = get_flashed_messages(with_categories=true, category_filter=("create_roll",)) %}
{% if messages %}
<ul class=flashes>
{% for category, message in messages %}
<li class="{{ category }}">{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
<form method="POST" action="/rolls">
<label for="name">Nom :</label>
<input type="text" name="name"/><br/>
<label for="name">Date :</label>
<input type="date" name="roll_date"/><br/>
<label for="name">Heure :</label>
<input type="time" name="roll_time"/><br/>
<input type="submit" name="submit" value="create"/>
</form>
</div>
<hr/>
{% endif%}
<h3>Liste des tirages :</h3>
{% for roll in rolls %}
<div class="roll">
{% if session.logged and roll.winner == None %}
{% with messages = get_flashed_messages(with_categories=true, category_filter=(roll.id,)) %}
{% if messages %}
<ul class=flashes>
{% for category, message in messages %}
<li class="{{ category }}">{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
<form method="POST" action="/rolls/{{roll.id}}">
<label for="name">Nom :</label>
<input type="text" name="name" value="{{roll.name}}"/><br/>
<label for="name">Date :</label>
<input type="date" name="roll_date" value="{{roll.roll_date}}"/><br/>
<label for="name">Heure :</label>
<input type="time" name="roll_time" value="{{roll.roll_time}}"/><br/>
<input type="submit" name="submit" value="update"/>
</form>
{% else %}
<h4 class="roll_title">
{{ roll.name }} le {{roll.print_datetime}}
</h4>
{% endif %}
{% if roll.winner != None %}
<div class="winner_div">
Lea gagnant⋅e de ce tirage est : <span class="winner_name">{{ roll.winner.name }}</span>
</div>
{% endif %}
<div class="subs">
<ol>
{% for sub in roll.subs %}
<li>
{{ sub.name }}{% if not roll.winner %} <a href="/unsubscribe?sub={{sub.id}}">désinscrire</a>{% endif %}
</li>
{% endfor %}
</ol>
</div>
{% if session.logged and roll.winner == None %}
<div>
<form method="POST" action="/rolls/{{roll.id}}/subscribe">
<label for="name">Inscrire un participant :</label>
<input type="text" name="name" />
<input type="submit" name="submit" value="Inscrire"/>
</form>
</div>
<hr/>
{% endif %}
</div>
{% endfor %}
{% endblock %}