first commit

This commit is contained in:
2022-04-03 14:19:54 +02:00
parent 2d16051195
commit 11ecbe1b51
8 changed files with 447 additions and 0 deletions

82
templates/index.html Normal file
View File

@@ -0,0 +1,82 @@
{% 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 %}

28
templates/master.html Normal file
View File

@@ -0,0 +1,28 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Luto de La Lune d'Argent</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<nav class="navbar">
<div id="login-form">
{% if session.logged %}
<a href="/logout?callback={{request.path}}">logout</a>
{% else %}
<form method="POST" action="/login">
<input type="text" name="login" placeholder="Login" />
<input type="password" name="password" placeholder="Password"/>
<input type="hidden" name="callback" value="{{request.path}}" />
<input type="submit" name="submit" value="Se connecter"/>
</form>
{% endif %}
</div>
</nav>
<div id="main">
{% block main %}
{% endblock %}
</div>
</body>
</html>