Add frontend tests and other stuff
[recipes.git] / backend / templates / base_with_list.html
1 {% extends "base_with_header.html" %}
2
3 {% macro recipe_item(id, title, class) %}
4 <a href="/recipe/view/{{ id }}" class="{{ class }}">{{ title }}</a>
5 {% endmacro %}
6
7 {% block main_container %}
8 <div class="list">
9 <ul>
10 {% for (id, title) in recipes %}
11 <li>
12 {% match current_recipe_id %}
13 {# Don't know how to avoid repetition: comparing (using '==' or .eq()) current_recipe_id.unwrap() and id doesn't work. Guards for match don't exist.
14 See: https://github.com/djc/askama/issues/752 #}
15 {% when Some (current_id) %}
16 {% if current_id == id %}
17 {% call recipe_item(id, title, "recipe-item-current") %}
18 {% else %}
19 {% call recipe_item(id, title, "recipe-item") %}
20 {% endif %}
21 {% when None %}
22 {% call recipe_item(id, title, "recipe-item") %}
23 {% endmatch %}
24 </li>
25 {% endfor %}
26 </ul>
27 </div>
28 <div class="content">
29 {% block content %}{% endblock %}
30 </div>
31 {% endblock %}