restructure
This commit is contained in:
parent
9e44070fe7
commit
81fdafb907
13 changed files with 376 additions and 366 deletions
14
comfyrecipes/templates/base.html
Normal file
14
comfyrecipes/templates/base.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{% macro price(price) -%}
|
||||
{% if price != None and price is defined and price.price is defined %}{{price.price|round(1)|numprint}}{%else%}?{% endif %} {{price.currency}}
|
||||
{%- endmacro %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
8
comfyrecipes/templates/index.html
Normal file
8
comfyrecipes/templates/index.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
{%block title%}Recipes{%endblock%}
|
||||
{%block body %}
|
||||
<h1>Recipes</h1>
|
||||
{% for recipe in recipes %}
|
||||
<li>{% if recipe.price != None %}{{price(recipe.price)}} {%endif%}<a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
|
||||
{% endfor %}
|
||||
{%endblock%}
|
40
comfyrecipes/templates/recipe.html
Normal file
40
comfyrecipes/templates/recipe.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
{% extends "base.html" %}
|
||||
{% macro ingredientpart(ing) -%}
|
||||
{% if recipe.price != None %}{{price(ing.price)}} {%endif%}{{ing.amount|amountprint}} {{ing["unit"].name}} {{ ing.name }} {{ing.note}}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro ingredient(ing) -%}
|
||||
{{ingredientpart(ing)}}
|
||||
{% if ing.alternatives|length != 0 %}
|
||||
{% for alting in ing.alternatives %}
|
||||
or {{ingredientpart(alting)}}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro getrecipe(rec) -%}
|
||||
{% for subrecipe in rec.subrecipes %}
|
||||
{{getrecipe(subrecipe)}}
|
||||
{% endfor %}
|
||||
<h1>{{rec.title}}</h1>
|
||||
{% if rec.ingredients|length != 0 %}
|
||||
<h3>Ingredients</h3>
|
||||
{% for ing in rec.ingredients %}
|
||||
<li>{{ingredient(ing)}}</li>
|
||||
{% endfor %}
|
||||
{% if rec.price != None %}price: {{price(rec.price)}}{%endif%}
|
||||
{% endif %}
|
||||
{% if rec.steps|length != 0 %}
|
||||
<h3>Steps</h3>
|
||||
{% for step in rec.steps %}
|
||||
<li>{{ step }}</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<hr>
|
||||
{%- endmacro %}
|
||||
|
||||
{%block title%}{{recipe.title}}{%endblock%}
|
||||
{%block body %}
|
||||
<a href="index.html">back</a>
|
||||
{{getrecipe(recipe)}}
|
||||
{%endblock%}
|
Loading…
Add table
Add a link
Reference in a new issue