Add frontend tests and other stuff

This commit is contained in:
Greg Burri 2022-12-07 00:16:34 +01:00
parent d28e765e39
commit 642dd8a80c
26 changed files with 730 additions and 85 deletions

View file

@ -1,22 +1,25 @@
{% extends "base_with_header.html" %}
{% macro recipe_item(id, title, class) %}
<a href="/recipe/view/{{ id }}" class="{{ class }}">{{ title }}</a>
{% endmacro %}
{% block main_container %}
<div class="list">
<ul>
{% for (id, title) in recipes %}
<li>
{% let item_html = "<a href=\"/recipe/view/{}\">{}</a>"|format(id, title) %}
{% match current_recipe_id %}
{# 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.
See: https://github.com/djc/askama/issues/752 #}
{% when Some (current_id) %}
{% if current_id == id %}
[{{ item_html|escape("none") }}]
{% call recipe_item(id, title, "recipe-item-current") %}
{% else %}
{{ item_html|escape("none") }}
{% call recipe_item(id, title, "recipe-item") %}
{% endif %}
{% when None %}
{{ item_html|escape("none") }}
{% call recipe_item(id, title, "recipe-item") %}
{% endmatch %}
</li>
{% endfor %}