templates: use inheritance

This commit is contained in:
Emi Vasilek 2023-11-05 11:52:10 +01:00
parent 3d3f0b0012
commit f813ae5ac3
3 changed files with 33 additions and 34 deletions

View file

@ -1,3 +1,4 @@
{% extends "base.html" %}
{% macro ingredientpart(ing) -%}
{{ing.amount}} {{ing.unit.name}} {{ ing.name }}
{%- endmacro %}
@ -9,27 +10,20 @@
{% endfor %}
{% endif %}
{%- endmacro %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{recipe.title}}</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
<meta charset="utf-8">
</head>
<body>
<a href="index.html">back</a>
<h1>{{recipe.title}}</h1>
{% for part in recipe.parts %}
<h2>{{part.title}}</h2>
<h3>Ingredients</h3>
{% for ing in part.ingredients %}
<li>{{ingredient(ing)}}</li>
{% endfor %}
<h3>Steps</h3>
{% for step in part.steps %}
<li>{{ step }}</li>
{% endfor %}
<hr>
{% endfor %}
</body>
</html>
{%block title%}{{recipe.title}}{%endblock%}
{%block body %}
<a href="index.html">back</a>
<h1>{{recipe.title}}</h1>
{% for part in recipe.parts %}
<h2>{{part.title}}</h2>
<h3>Ingredients</h3>
{% for ing in part.ingredients %}
<li>{{ingredient(ing)}}</li>
{% endfor %}
<h3>Steps</h3>
{% for step in part.steps %}
<li>{{ step }}</li>
{% endfor %}
<hr>
{% endfor %}
{%endblock%}