X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=backend%2Ftemplates%2Fbase_with_list.html;h=e9db9793825dfb6b34508c05d5c11c72228096d1;hb=642dd8a80ce2e1212b8e30c1edabb32bdb416cfc;hp=715c9e791ee65e02e99a38c518f860648f01be59;hpb=d28e765e39e70ad2ab9a42885c786d5d8ba9ba40;p=recipes.git
diff --git a/backend/templates/base_with_list.html b/backend/templates/base_with_list.html
index 715c9e7..e9db979 100644
--- a/backend/templates/base_with_list.html
+++ b/backend/templates/base_with_list.html
@@ -1,22 +1,25 @@
{% extends "base_with_header.html" %}
+{% macro recipe_item(id, title, class) %}
+{{ title }}
+{% endmacro %}
+
{% block main_container %}
{% for (id, title) in recipes %}
-
- {% let item_html = "{}"|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 %}
{% endfor %}