commit a5afce2e2d06fb4d7cceb3443ce1a7986792d1ee
parent 51cee0894814fad4ba7842dd6413f934e2c2923e
Author: Oshgnacknak <osh@oshgnacknak.de>
Date: Thu, 27 Jun 2019 14:42:28 +0100
split up templates
Diffstat:
5 files changed, 64 insertions(+), 62 deletions(-)
diff --git a/smtl/templates/flashes.html b/smtl/templates/flashes.html
@@ -0,0 +1,9 @@
+{% with messages = get_flashed_messages(with_categories=true) %}
+ {% if messages %}
+ <ul id="flashes">
+ {% for category, message in messages %}
+ <li class="{{ category }}">{{ message }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+{% endwith %}
diff --git a/smtl/templates/home.html b/smtl/templates/home.html
@@ -1,66 +1,17 @@
<!doctype html>
<html lang="en">
-
-<head>
- <meta charset="utf-8">
-
- <title>{{ title }}</title>
-
- {% for name, content in meta.items() %}
- <meta name="{{ name }}" content="{{ content }}">
- {% endfor %}
-
- <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
-</head>
-
-<body>
- <h2 id="title">{{ title }}</h2>
-
- {% with messages = get_flashed_messages(with_categories=true) %}
- {% if messages %}
- <ul id="flashes">
- {% for category, message in messages %}
- <li class="{{ category }}">{{ message }}</li>
- {% endfor %}
- </ul>
- {% endif %}
- {% endwith %}
-
- <form action="/signup" id="signup_form" method="POST">
- <table>
- {% for field in [form.firstname, form.lastname, form.club, form.dwz, form.email] %}
- <tr>
- <td>{{ field.label }}</td>
- <td>{{ field }}</td>
- </tr>
- {% endfor %}
- <tr>
- <td>
- <input type="submit" value="Teilnehmen">
- <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
- </td>
- <td><input type="reset" value="Löschen"></td>
- </tr>
- </table>
- </form>
-
- <table id="player_table">
- <tr>
- <th>Name</th>
- <th>Verein</th>
- <th>DWZ</th>
- </tr>
- {% for player in players %}
- <tr>
- <td>{{ player.firstname }} {{ player.lastname }}</td>
- <td>{{ player.club }}</td>
- <td>{{ player.dwz }}</td>
- </tr>
- {% endfor %}
- </table>
-
- <script type="module" src="{{ url_for('static', filename='js/main.js') }}"></script>
-</body>
-
+ <head>
+ <meta charset="utf-8">
+ <title>{{ title }}</title>
+ {% include 'meta.html' %}
+ <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
+ </head>
+ <body>
+ <h2 id="title">{{ title }}</h2>
+ {% include 'flashes.html' %}
+ {% include 'signup_form.html' %}
+ {% include 'player_table.html' %}
+ <script type="module" src="{{ url_for('static', filename='js/main.js') }}"></script>
+ </body>
</html>
diff --git a/smtl/templates/meta.html b/smtl/templates/meta.html
@@ -0,0 +1,5 @@
+{% if meta %}
+ {% for name, content in meta.items() %}
+ <meta name="{{ name }}" content="{{ content }}">
+ {% endfor %}
+{% endif %}
diff --git a/smtl/templates/player_table.html b/smtl/templates/player_table.html
@@ -0,0 +1,20 @@
+{% if players %}
+ <table id="player_table">
+ <tr>
+ <th>Name</th>
+ <th>Verein</th>
+ <th>DWZ</th>
+ </tr>
+ {% for player in players %}
+ <tr>
+ <td>{{ player.firstname }} {{ player.lastname }}</td>
+ <td>{{ player.club }}</td>
+ <td>{{ player.dwz }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+{% else %}
+ <div id="player_table" class="no_players">
+ <b>Noch keine Spieler...</b>
+ </div>
+{% endif %}
diff --git a/smtl/templates/signup_form.html b/smtl/templates/signup_form.html
@@ -0,0 +1,17 @@
+<form action="/signup" id="signup_form" method="POST">
+ <table>
+ {% for field in [form.firstname, form.lastname, form.club, form.dwz, form.email] %}
+ <tr>
+ <td>{{ field.label }}</td>
+ <td>{{ field }}</td>
+ </tr>
+ {% endfor %}
+ <tr>
+ <td>
+ <input type="submit" value="Teilnehmen">
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
+ </td>
+ <td><input type="reset" value="Löschen"></td>
+ </tr>
+ </table>
+</form>