aboutsummaryrefslogtreecommitdiff
path: root/templates/components/app.html
blob: f2fe58726c2a511111f32306d273ec222a1bd010 (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
49
50
51
52
<!-- Renders the main part of the app, including recipes, filters, pagination -->

<div class="app">
  <div style="display: flex;">
    <h3 style="margin-right:10px;">Filter by tag</h3>
    <img src={{url_for("static", filename="images/bars.svg")}} class="htmx-indicator" id="spinner-3" alt="loading indicator "/>
  </div>
  <form
    class="tags"
    hx-post="/recipes/search"
    hx-trigger="change"
    hx-include="#search"
    hx-target=".app"
    hx-swap="innerHTML"
    hx-indicator="spinner-3"
    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>