aboutsummaryrefslogtreecommitdiff
path: root/templates/components/app.html
blob: 6a4c83a18f4089594ba87af29afba0a3d42c1917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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>