Add asynchronous call to database.

See file 'asynchronous.ts'.
This commit is contained in:
Greg Burri 2022-11-29 15:58:06 +01:00
parent 8a3fef096d
commit d28e765e39
20 changed files with 1323 additions and 1049 deletions

View file

@ -1,10 +1,24 @@
{% extends "base.html" %}
{% extends "base_with_header.html" %}
{% block main_container %}
<div class="list">
<ul>
{% for (id, title) in recipes %}
<li><a href="/recipe/view/{{ id }}">{{ title }}</a></li>
<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") }}]
{% else %}
{{ item_html|escape("none") }}
{% endif %}
{% when None %}
{{ item_html|escape("none") }}
{% endmatch %}
</li>
{% endfor %}
</ul>
</div>