feat: overhaul templating system

This commit is contained in:
Jef Roosens 2025-01-10 15:16:01 +01:00
parent 03b3f692e1
commit 4a4b8bba3d
No known key found for this signature in database
GPG key ID: 21FD3D77D56BAF49
22 changed files with 157 additions and 127 deletions

View file

@ -0,0 +1,22 @@
{% macro li(comment) %}
<li>{{ comment.comment }}</li>
{% endmacro li %}
{% macro list(comments) %}
<div id="comments">
<ul id="comments_ul">
{% for comment in comments %}
{{ self::li(comment=comment) }}
{% endfor %}
</ul>
</div>
{% endmacro list %}
{% macro form(plant_id, target="#comments > ul") %}
<form hx-post="/comments" hx-target="{{ target }}" hx-swap="beforeend">
<input type="hidden" id="plant_id" name="plant_id" value="{{ plant_id }}">
<label for="comment">Comment:</label>
<textarea id="comment" name="comment" rows=4></textarea></br>
<input type="submit">
</form>
{% endmacro form %}