aboutsummaryrefslogtreecommitdiff
path: root/templates/components/app.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/components/app.html')
-rw-r--r--templates/components/app.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/templates/components/app.html b/templates/components/app.html
new file mode 100644
index 0000000..6a4c83a
--- /dev/null
+++ b/templates/components/app.html
@@ -0,0 +1,48 @@
+<!-- Renders the main part of the app, including recipes, filters, pagination -->
+
+<div class="app">
+ <h3>Filter by tag</h3>
+ <form
+ class="tags"
+ hx-post="/recipes/search"
+ hx-trigger="change"
+ hx-include="#search"
+ hx-target=".app"
+ hx-swap="innerHTML"
+ id="facets"
+ >
+ {% for facet in facets %}
+ <label
+ ><input
+ type="checkbox"
+ name="choice-{{ loop.index }}"
+ value="{{ facet.name }}"
+ {%
+ if
+ facet.checked
+ %}
+ checked
+ {%
+ endif
+ %}
+ />{{ facet.name }}</label
+ >
+ {% endfor %}
+ </form>
+ <hr />
+
+ {% if recipes|length > 0 %}
+ <ul class="recipes">
+ {% for recipe in recipes %}
+ <li>
+ <a href="/recipe/{{recipe._id}}">{{ recipe.title }}</a>
+ <span>{{ recipe.author }}</span>
+ </li>
+ {% endfor %}
+ </ul>
+
+ {% else %}
+ <p><i>No recipes found</i></p>
+ {% endif %}
+ <div></div>
+</div>