33 lines
1.3 KiB
HTML
33 lines
1.3 KiB
HTML
{% extends "base_with_header.html" %}
|
|
|
|
{% macro recipe_item(id, title, class) %}
|
|
<a href="/recipe/view/{{ id }}" class="{{ class }}">{{ title }}</a>
|
|
{% endmacro %}
|
|
|
|
{% block main_container %}
|
|
<nav class="list">
|
|
<ul>
|
|
{% for (id, title) in recipes %}
|
|
<li>
|
|
{% 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 %}
|
|
{% call recipe_item(id, title, "recipe-item-current") %}
|
|
{% else %}
|
|
{% call recipe_item(id, title, "recipe-item") %}
|
|
{% endif %}
|
|
{% when None %}
|
|
{% call recipe_item(id, title, "recipe-item") %}
|
|
{% endmatch %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</nav>
|
|
<div class="content">
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
{% endblock %}
|