feat: overhaul templating system
This commit is contained in:
parent
03b3f692e1
commit
4a4b8bba3d
22 changed files with 157 additions and 127 deletions
36
templates/components/event.html
Normal file
36
templates/components/event.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{% macro li(event) %}
|
||||
<li>
|
||||
<div class="event">
|
||||
<b>{{ event.event_type }}</b>
|
||||
<p>{{ event.date }}</p>
|
||||
<p>{{ event.description }}</p>
|
||||
</div>
|
||||
</li>
|
||||
{% endmacro li %}
|
||||
|
||||
{% macro list(events) %}
|
||||
<div id="events">
|
||||
<ul>
|
||||
{% for event in events %}
|
||||
{{ self::li(event=event) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endmacro ul %}
|
||||
|
||||
{% macro form(plant_id, target="#events > ul") %}
|
||||
<form hx-post="/events" hx-target="{{ target }}" hx-swap="beforeend">
|
||||
<input type="hidden" id="plant_id" name="plant_id" value="{{ plant_id }}">
|
||||
<label for="event_type">Type:</label>
|
||||
<select id="event_type" name="event_type">
|
||||
{% for type in event_types %}
|
||||
<option value="{{ type }}">{{ type }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<label for="date">Date:</label>
|
||||
<input type="date" id="date" name="date">
|
||||
<label for="description">Description:</label>
|
||||
<textarea id="description" name="description" rows=2></textarea></br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
{% endmacro form %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue