aboutsummaryrefslogtreecommitdiff
path: root/src/match_up/templates/macros.j2
diff options
context:
space:
mode:
authorKaran Jayachandra <mail@karanjayachandra.com>2024-11-09 18:19:48 +0000
committerKaran Jayachandra <mail@karanjayachandra.com>2024-11-09 18:19:48 +0000
commit1a7ae4bc2b759de7a03e6ad83632e6ad678754c8 (patch)
tree5b771e755f3a55c6794c649431de35798242a2e0 /src/match_up/templates/macros.j2
parent2b18e0929a0b3e083cbe9e5e8ffd421ed8d17e52 (diff)
parent75a3ef7d14fcaedab29da46ba3dc5cf9c1bab699 (diff)
Merge branch 'feature/package' into 'develop'
Implemented packaging and command line arguments See merge request KaranJayachandra/match_up!10
Diffstat (limited to 'src/match_up/templates/macros.j2')
-rw-r--r--src/match_up/templates/macros.j267
1 files changed, 67 insertions, 0 deletions
diff --git a/src/match_up/templates/macros.j2 b/src/match_up/templates/macros.j2
new file mode 100644
index 0000000..dedbf48
--- /dev/null
+++ b/src/match_up/templates/macros.j2
@@ -0,0 +1,67 @@
+{% macro court(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>
+{%- endmacro %}
+
+{% macro guests(count) -%}
+<div class="control" id="guests">
+ <input class="input is-responsive" type="text" style="text-align:center" value="{{ count }} Guests" disabled>
+</div>
+{%- endmacro %}
+
+{% macro timer(mins, secs) -%}
+<div hx-get="/time" hx-swap="outerHTML" hx-trigger="every 1s">
+ <p class="title">⏲️ {{mins}}:{{secs}}</p>
+</div>
+{%- endmacro %}
+
+{% macro header(url_for) -%}
+<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="{{ url_for('static', filename='favicon.ico') }}">
+ <link rel="stylesheet" href="{{ url_for('static', filename='bulma.min.css') }}">
+ <link rel="stylesheet" href="{{ url_for('static', filename='custom.css') }}">
+ <script src="{{ url_for('static', filename='htmx.min.js') }}"></script>
+</head>
+{%- endmacro %}
+
+{% macro footer() -%}
+<div class="content has-text-centered">Made by <a href="https://karanjayachandra.com/">Karan</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>
+{%- endmacro %}
+
+{% macro navbar(url_for) -%}
+<nav class="level">
+ <div class="level-left">
+ <div class="level-item">
+ <figure class="image container is-128x128">
+ <img src="{{ url_for('static', filename='logo.png') }}"/>
+ </figure>
+ </div>
+ </div>
+ <div class="level-item has-text-centered"></div>
+ <p class="level-item has-text-centered">
+ <button class="button is-link" onclick="location.href = '/';">Games</button>
+ </p>
+ <div class="level-item has-text-centered"></div>
+ <div class="level-item has-text-centered">
+ <p class="title">Match Up!</p>
+ </div>
+ <div class="level-item has-text-centered"></div>
+ <p class="level-item has-text-centered">
+ <button class="button is-link" onclick="location.href = '/players';">Players</button>
+ </p>
+ <div class="level-item has-text-centered"></div>
+ <div class="level-right">
+ <div hx-get="/time" hx-swap="outerHTML" hx-trigger="load"></div>
+ </div>
+</nav>
+{%- endmacro %} \ No newline at end of file