aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/court.j21
-rw-r--r--templates/courts.j210
-rw-r--r--templates/games.j22
-rw-r--r--templates/index.j218
4 files changed, 21 insertions, 10 deletions
diff --git a/templates/court.j2 b/templates/court.j2
new file mode 100644
index 0000000..6ae4d91
--- /dev/null
+++ b/templates/court.j2
@@ -0,0 +1 @@
+<button class={% if court.status %} "active" {% else %} "dormant" {% endif %} hx-post="{{ "/court-toggle/" ~ court.number}}" hx-trigger="click" hx-swap="outerHTML">{{ court.number }}</button> \ No newline at end of file
diff --git a/templates/courts.j2 b/templates/courts.j2
index a7893a7..3134aca 100644
--- a/templates/courts.j2
+++ b/templates/courts.j2
@@ -1,3 +1,7 @@
-<form hx-post="/courts" hx-trigger="change" hx-swap="outerHTML">
- <input type="number" disabled id="courts" min="1" max="15" name="courts" value="{{ courts }}">
-</form> \ No newline at end of file
+<div class="grid-container">
+{% for court in courts %}
+ <div class="grid-item">
+ <button class={% if court.status %} "active" {% else %} "dormant" {% endif %} hx-post="{{ "/court-toggle/" ~ court.number}}" hx-trigger="click" hx-swap="outerHTML">{{ court.number }}</button>
+ </div>
+{% endfor %}
+</div> \ No newline at end of file
diff --git a/templates/games.j2 b/templates/games.j2
index 22ea936..83fff7f 100644
--- a/templates/games.j2
+++ b/templates/games.j2
@@ -7,7 +7,7 @@
</tr>
{% for game in games %}
<tr>
- <th>{{ loop.index }}</th>
+ <th>{{ game.court.number }}</th>
<td>{{ game.team1.player1.name }}</th>
<td>{{ game.team1.player2.name }}</th>
<td>{{ game.team2.player1.name }}</th>
diff --git a/templates/index.j2 b/templates/index.j2
index be92207..a9c451f 100644
--- a/templates/index.j2
+++ b/templates/index.j2
@@ -4,8 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🏸Match Up!</title>
- <link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
- <script src="https://unpkg.com/htmx.org@1.9.11"></script>
+ <link rel="stylesheet" href="https://unpkg.com/sakura.css/css/sakura.css" type="text/css">
+ <script src="https://unpkg.com/htmx.org@2.0.0/dist/htmx.min.js"></script>
<style>
button {
height: 50px;
@@ -23,25 +23,31 @@
row-gap: 20px;
column-gap: 20px;
}
- .tagline {
- text-align: center;
+ hr {
+ margin-top: 1cm;
}
</style>
</head>
<body>
<header>
- <h1>🏸The Smashing Fellows </h1>
- <h4> Total Courts: 8</h4>
+ <h4>🏸The Smashing Fellows </h4>
</header>
+ <hr>
<div>
<h2>Games</h2>
<div class="games" hx-get="/game-list" hx-swap="outerHTML" hx-trigger="revealed"></div>
</div>
<button hx-post="/new-games" hx-trigger="click" hx-target=".games" hx-swap="outerHTML"> New Games </button>
<div class="players">
+ <h2>Courts</h2>
+ <div hx-get="/court-list" hx-swap="outerHTML" hx-trigger="revealed"></div>
+ </div>
+ <hr>
+ <div class="players">
<h2>Players</h2>
<div hx-get="/player-list" hx-swap="outerHTML" hx-trigger="revealed"></div>
</div>
+ <hr>
<footer>
Made by <a href="https://karanjayachandra.com/">K. Jayachandra</a> using <a href="https://htmx.org/">HTMX</a> and <a href="https://flask.palletsprojects.com">Flask</a>
</footer>