diff options
Diffstat (limited to 'src/match_up/templates')
| -rw-r--r-- | src/match_up/templates/controls.j2 | 28 | ||||
| -rw-r--r-- | src/match_up/templates/games.j2 | 10 | ||||
| -rw-r--r-- | src/match_up/templates/macros.j2 | 14 | ||||
| -rw-r--r-- | src/match_up/templates/players.j2 | 63 |
4 files changed, 75 insertions, 40 deletions
diff --git a/src/match_up/templates/controls.j2 b/src/match_up/templates/controls.j2 index 6ba724a..e9e37f3 100644 --- a/src/match_up/templates/controls.j2 +++ b/src/match_up/templates/controls.j2 @@ -1,30 +1,13 @@ -{% from "macros.j2" import court %} +{% from "macros.j2" import court_button %} <div class="fixed-grid has-6-cols"> <div class="grid"> {% for key, value in courts.items() %} - {{ court(key, value) }} + {{ court_button(key, value) }} {% endfor %} </div> </div> <div class="columns"> <div class="column"> - <div class="field has-addons"> - <div class="control"> - <button class="button is-responsive is-dark" - hx-post="/decrement" - hx-swap="outerHTML" - hx-target="#guests">-</button> - </div> - <div hx-get="/guests" hx-swap="outerHTML" hx-trigger="revealed"></div> - <div class="control"> - <button class="button is-responsive is-dark" - hx-post="/increment" - hx-swap="outerHTML" - hx-target="#guests">+</button> - </div> - </div> - </div> - <div class="column"> <div class="select is-responsive"> <select name="type"> <option>10 Levels</option> @@ -40,7 +23,7 @@ <button class="button is-dark is-responsive" hx-post="/propose" hx-target="#games" - hx-include="[name='type']">New Round</button> + hx-include="[name='type']">Shuffle</button> </div> <div class="column"></div> <div class="column"> @@ -48,9 +31,4 @@ hx-post="/confirm" hx-target="#games">Start Round</button> </div> - <div class="column"> - <button class="button is-dark is-responsive" - hx-post="/clear" - hx-target="#games">Reset</button> - </div> </div>
\ No newline at end of file diff --git a/src/match_up/templates/games.j2 b/src/match_up/templates/games.j2 index d5afef1..46150f7 100644 --- a/src/match_up/templates/games.j2 +++ b/src/match_up/templates/games.j2 @@ -9,12 +9,12 @@ </thead> <tbody> {% for game in games %} - <tr {% if game.team1.player1 == 'RESERVED' %} class="is-danger" {% endif %}> + <tr {% if game.team1.player1.first == 'RESERVED' %} class="is-danger" {% endif %}> <th align="center" style="width: 8%;">{{ game.court }}</th> - <td style="width: 23%;">{{ game.team1.player1 }}</th> - <td style="width: 23%;">{{ game.team1.player2 }}</th> - <td style="width: 23%;">{{ game.team2.player1 }}</th> - <td style="width: 23%;">{{ game.team2.player2 }}</th> + <td style="width: 23%;"><strong>{{ game.team1.player1.first }}</strong>{{ " " + game.team1.player1.last }}</th> + <td style="width: 23%;"><strong>{{ game.team1.player2.first }}</strong>{{ " " + game.team1.player2.last }}</th> + <td style="width: 23%;"><strong>{{ game.team2.player1.first }}</strong>{{ " " + game.team2.player1.last }}</th> + <td style="width: 23%;"><strong>{{ game.team2.player2.first }}</strong>{{ " " + game.team2.player2.last }}</th> </tr> {% endfor %} </tbody> diff --git a/src/match_up/templates/macros.j2 b/src/match_up/templates/macros.j2 index dedbf48..7e1f6bd 100644 --- a/src/match_up/templates/macros.j2 +++ b/src/match_up/templates/macros.j2 @@ -1,17 +1,17 @@ -{% macro court(id, status) -%} +{% macro court_button(id, status) -%} <button class= "button is-responsive {% if status %}is-success{% else %}is-danger{% endif %}" hx-post="{{ "/court-toggle/" ~ id}}" hx-swap="outerHTML"> Court {{ id }}</button> {%- endmacro %} -{% macro player(id, status, name) -%} -<button class="button is-responsive {% if status %}is-success{% else %}is-danger {% endif %}" - hx-post="{{ "/player-toggle/" ~ id}}" - hx-swap="outerHTML"> {{ name }} </button> +{% macro player_button(player) -%} +<button class="button is-responsive {% if player.status %}is-success{% else %}is-danger {% endif %}" + hx-post="{{ "/player-toggle/" ~ player.id}}" + hx-swap="outerHTML"> {{ player.first + " " + player.last}} </button> {%- endmacro %} -{% macro guests(count) -%} -<div class="control" id="guests"> +{% macro guests(count, level) -%} +<div class="control" id="{{level}}guests"> <input class="input is-responsive" type="text" style="text-align:center" value="{{ count }} Guests" disabled> </div> {%- endmacro %} diff --git a/src/match_up/templates/players.j2 b/src/match_up/templates/players.j2 index 0d1f96c..f25889c 100644 --- a/src/match_up/templates/players.j2 +++ b/src/match_up/templates/players.j2 @@ -1,4 +1,4 @@ -{% from "macros.j2" import header, navbar, footer, player %} +{% from "macros.j2" import header, navbar, footer, player_button %} <!doctype html> <html lang="en"> {{ header(url_for) }} @@ -7,10 +7,67 @@ {{ navbar(url_for) }} <div class="fixed-grid has-4-cols"> <div class="grid"> - {% for id, value in players.items() %} - <div class="cell"> {{ player(id, value.status, value.name) }} </div> + {% for player in players %} + <div class="cell"> {{ player_button(player) }} </div> {% endfor %} </div> + <div class="columns"> + <div class="column"> + <div class="field has-addons"> + <div class="control"> + <button class="button is-responsive is-dark" + hx-post="/decrement_low_guest" + hx-swap="outerHTML" + hx-target="#lowguests">-</button> + </div> + <div hx-get="/low_guests" hx-swap="outerHTML" hx-trigger="revealed"></div> + <div class="control"> + <button class="button is-responsive is-dark" + hx-post="/increment_low_guest" + hx-swap="outerHTML" + hx-target="#lowguests">+</button> + </div> + </div> + </div> + <div class="column"> + <div class="field has-addons"> + <div class="control"> + <button class="button is-responsive is-dark" + hx-post="/decrement_mid_guest" + hx-swap="outerHTML" + hx-target="#midguests">-</button> + </div> + <div hx-get="/mid_guests" hx-swap="outerHTML" hx-trigger="revealed"></div> + <div class="control"> + <button class="button is-responsive is-dark" + hx-post="/increment_mid_guest" + hx-swap="outerHTML" + hx-target="#midguests">+</button> + </div> + </div> + </div> + <div class="column"> + <div class="field has-addons"> + <div class="control"> + <button class="button is-responsive is-dark" + hx-post="/decrement_high_guest" + hx-swap="outerHTML" + hx-target="#highguests">-</button> + </div> + <div hx-get="/high_guests" hx-swap="outerHTML" hx-trigger="revealed"></div> + <div class="control"> + <button class="button is-responsive is-dark" + hx-post="/increment_high_guest" + hx-swap="outerHTML" + hx-target="#highguests">+</button> + </div> + </div> + </div> + <div class="column"> + <button class="button is-dark is-responsive" + hx-post="/reset_players">Reset!</button> + </div> + </div> {{ footer() }} </section> </body> |
