diff options
| author | Karan Jayachandra <mail@karanjayachandra.com> | 2024-10-14 08:51:59 +0000 |
|---|---|---|
| committer | Karan Jayachandra <mail@karanjayachandra.com> | 2024-10-14 08:51:59 +0000 |
| commit | eac95cc2e259badf3a8c3309e6e7be97d5cbd868 (patch) | |
| tree | 492b1497cf648e08e84a35dea2d217a57643dab0 /templates | |
| parent | 2b264abdf62822936e3510b0f9690ba1e359a9b8 (diff) | |
| parent | f80463a6437533deef1d85ffa31cf0cc5ed8e454 (diff) | |
Merge branch 'pure' into 'develop'
Dash to Flask HTML Conversion
See merge request KaranJayachandra/match_up!1
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/court.j2 | 1 | ||||
| -rw-r--r-- | templates/courts.j2 | 9 | ||||
| -rw-r--r-- | templates/games.j2 | 18 | ||||
| -rw-r--r-- | templates/index.html | 51 | ||||
| -rw-r--r-- | templates/index.j2 | 52 | ||||
| -rw-r--r-- | templates/macro.j2 | 3 | ||||
| -rw-r--r-- | templates/player.j2 | 1 | ||||
| -rw-r--r-- | templates/players.j2 | 8 |
8 files changed, 92 insertions, 51 deletions
diff --git a/templates/court.j2 b/templates/court.j2 new file mode 100644 index 0000000..425e7d5 --- /dev/null +++ b/templates/court.j2 @@ -0,0 +1 @@ +<button class={% if court.status %} "button is-success" {% else %} "button is-danger" {% 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 new file mode 100644 index 0000000..64fd44a --- /dev/null +++ b/templates/courts.j2 @@ -0,0 +1,9 @@ +<div class="fixed-grid has-12-cols"> +<div class="grid"> +{% for court in courts %} + <div class="cell"> + <button class={% if court.status %} "button is-success" {% else %} "button is-danger" {% endif %} hx-post="{{ "/court-toggle/" ~ court.number}}" hx-trigger="click" hx-swap="outerHTML">{{ court.number }}</button> + </div> +{% endfor %} +</div> +</div>
\ No newline at end of file diff --git a/templates/games.j2 b/templates/games.j2 new file mode 100644 index 0000000..b070b16 --- /dev/null +++ b/templates/games.j2 @@ -0,0 +1,18 @@ +<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth" id="games"> +<thead> + <th> Court </th> + <th colspan="2"> Team 1 </th> + <th colspan="2"> Team 2 </th> +</thead> +<tbody> +{% for game in games %} + <tr> + <th>{{ game.court.number }}</th> + <td>{{ game.team1.player1.name }}</th> + <td>{{ game.team1.player2.name }}</th> + <td>{{ game.team2.player1.name }}</th> + <td>{{ game.team2.player2.name }}</th> + </tr> +{% endfor %} +</tbody> +</table>
\ No newline at end of file diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index db4a991..0000000 --- a/templates/index.html +++ /dev/null @@ -1,51 +0,0 @@ -<!doctype html> -<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css"> - -<html> - <head> - <title>Match Up!</title> - </head> - <body> - <h1>Match Up!</h1> - <div class="row"> - <div style=" float: left; width: 60%"> - <table> - <thead> - <tr> - <th> Court </th> - <th> Team 1 </th> - <th> Team 2 </th> - </tr> - </thead> - <tbody> - {% for game in game_list %} - <tr> - <td width="10%"> {{game.court_number}} </td> - <td width="40%"> {{game.team_1.player_1.get_name()}} <br> {{game.team_1.player_2.get_name()}} </td> - <td width="40%"> {{game.team_2.player_1.get_name()}} <br> {{game.team_2.player_2.get_name()}} </td> - </tr> - {% endfor %} - </tbody> - </table> - </div> - <div style=" float: left; width: 30%"> - <table> - <thead> - <tr> - <th> Player </th> - </tr> - </thead> - <tbody> - {% for player in player_list %} - <tr> - <td style={% if player.status %} "color : green" {% else %} "color : red" {% endif %}> - {{ player.get_name() }} - </td> - </tr> - {% endfor %} - </tbody> - </table> - </div> - </div> - </body> -</html>
\ No newline at end of file diff --git a/templates/index.j2 b/templates/index.j2 new file mode 100644 index 0000000..cfd32b5 --- /dev/null +++ b/templates/index.j2 @@ -0,0 +1,52 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>🏸Match Up!</title> + <link rel="icon" type="image/x-icon" href="/images/favicon.ico"> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.2/css/bulma.min.css"> + <script src="https://unpkg.com/htmx.org@2.0.0/dist/htmx.min.js"></script> + <style> + button { + width: 100%; + } + td { + text-align:center; + width:20%; + } + </style> + </head> + <body> + <section class="hero"> + <div class="hero-body"> + <p class="title">🏸The Smashing Fellows </p> + </div> + </section> + <section class="section"> + <p class="title">Games</p> + <div class="columns"> + <div class="column"></div> + <div class="column"><button class="button is-success" hx-post="/random-games" hx-trigger="click" hx-target="#games">Random Games</button></div> + <div class="column"><button class="button is-success" hx-post="/skilled-games" hx-trigger="click" hx-target="#games">Skilled Games</button></div> + <div class="column"></div> + <div class="column"><button class="button is-danger" hx-post="/clear-games" hx-trigger="click" hx-target="#games">Clear</button></div> + <div class="column"></div> + </div> + <div hx-get="/game-list" hx-swap="outerHTML" hx-trigger="revealed"></div> + </section> + <section class="section"> + <h2 class="title">Courts</h2> + <div hx-get="/court-list" hx-swap="outerHTML" hx-trigger="revealed"></div> + </section> + <section class="section"> + <h2 class="title">Players</h2> + <div hx-get="/player-list" hx-swap="outerHTML" hx-trigger="revealed"></div> + </section> + <footer class="footer"> + <div class="content has-text-centered"> + Made by <a href="https://karanjayachandra.com/">K. Jayachandra</a> using <a href="https://flask.palletsprojects.com">Flask</a>, <a href="https://htmx.org/">HTMX</a> and <a href="https://bulma.io">Bulma</a> + </div> + </footer> + </body> +</html>
\ No newline at end of file diff --git a/templates/macro.j2 b/templates/macro.j2 new file mode 100644 index 0000000..e0089bc --- /dev/null +++ b/templates/macro.j2 @@ -0,0 +1,3 @@ +{% macro player_button(player) %} +<button class={% if player.status %} "active" {% else %} "dormant" {% endif %} hx-post="{{ "/player-toggle/" ~ player.name}}" hx-trigger="click" hx-swap="outerHTML">{{ player.name }}</button> +{%- endmacro %}
\ No newline at end of file diff --git a/templates/player.j2 b/templates/player.j2 new file mode 100644 index 0000000..5b70df6 --- /dev/null +++ b/templates/player.j2 @@ -0,0 +1 @@ +<button class={% if player.status %} "button is-success" {% else %} "button is-danger" {% endif %} hx-post="{{ "/player-toggle/" ~ player.name}}" hx-trigger="click" hx-swap="outerHTML">{{ player.name }}</button>
\ No newline at end of file diff --git a/templates/players.j2 b/templates/players.j2 new file mode 100644 index 0000000..6179dbb --- /dev/null +++ b/templates/players.j2 @@ -0,0 +1,8 @@ +<div class="fixed-grid has-5-cols"> +<div class="grid"> +{% for player in players %} + <div class="cell"> + <button class={% if player.status %} "button is-success" {% else %} "button is-danger" {% endif %} hx-post="{{ "/player-toggle/" ~ player.name}}" hx-trigger="click" hx-swap="outerHTML">{{ player.name }}</button> + </div> +{% endfor %} +</div>
\ No newline at end of file |
