recipes/backend/templates/recipe_view.html

87 lines
No EOL
2.5 KiB
HTML

{% extends "base_with_list.html" %}
{% block content %}
<div class="content" id="recipe-view">
<h2 class="recipe-title" >{{ recipe.title }}</h2>
{% if let Some(user) = user %}
{% if crate::data::model::can_user_edit_recipe(user, recipe) %}
<a class="edit-recipe" href="/recipe/edit/{{ recipe.id }}" >Edit</a>
{% endif %}
<span class="add-to-planner">Add to planner</span>
{% endif %}
<div class="tags">
{% for tag in recipe.tags %}
<span class="tag">{{ tag }}</span>
{% endfor %}
</div>
{% match recipe.servings %}
{% when Some(servings) %}
<span class="servings">
{% if *servings == 1 %}
{{ tr.t(Sentence::RecipeOneServing) }}
{% else %}
{{ tr.tp(Sentence::RecipeSomeServings, [Box::new(**servings)]) }}
{% endif %}
</span>
{% else %}
{% endmatch %}
{% match recipe.estimated_time %}
{% when Some(time) %}
{{ time +}} {{+ tr.t(Sentence::RecipeEstimatedTimeMinAbbreviation) }}
{% else %}
{% endmatch %}
<span class="difficulty">
{% match recipe.difficulty %}
{% when common::ron_api::Difficulty::Unknown %}
{% when common::ron_api::Difficulty::Easy %}
{{ tr.t(Sentence::RecipeDifficultyEasy) }}
{% when common::ron_api::Difficulty::Medium %}
{{ tr.t(Sentence::RecipeDifficultyMedium) }}
{% when common::ron_api::Difficulty::Hard %}
{{ tr.t(Sentence::RecipeDifficultyHard) }}
{% endmatch %}
</span>
{% if !recipe.description.is_empty() %}
<div class="recipe-description" >
{{ recipe.description }}
</div>
{% endif %}
{% for group in recipe.groups %}
<div class="group">
<h3>{{ group.name }}</h3>
<div class="steps">
{% for step in group.steps %}
<div class="ingredients">
{% for ingredient in step.ingredients %}
<div class="ingredient">
{% if let Some(quantity) = ingredient.quantity_value %}
{{ quantity +}}
{{+ ingredient.quantity_unit }}
{% endif +%}
{{+ ingredient.name }}
</div>
{% endfor %}
</div>
<div class="step">
{{ step.action }}
</div>
{% endfor %}
</div>
</div>
{% endfor %}
<div id="hidden-templates">
{% include "calendar.html" %}
</div>
</div>
{% endblock %}