recipes/backend/templates/recipe_edit.html

113 lines
No EOL
3.6 KiB
HTML

{% extends "base_with_list.html" %}
{% macro is_difficulty(diff) %}
{% if recipe.difficulty == diff %}
selected
{% endif %}
{% endmacro %}
{% block content %}
<div class="content" id="recipe-edit">
<label for="input-title">Title</label>
<input
id="input-title"
type="text"
value="{{ recipe.title }}"
autofocus="true" />
<label for="text-area-description">Description</label>
<textarea
id="text-area-description">{{ recipe.description }}</textarea>
<label for="input-estimated-time">Estimated time [min]</label>
<input
id="input-estimated-time"
type="number"
step="1" min="0" max="1000"
value="
{% match recipe.estimated_time %}
{% when Some with (t) %}
{{ t }}
{% when None %}
0
{% endmatch %}"/>
<label for="select-difficulty">Difficulty</label>
<select id="select-difficulty">
<option value="0" {%+ call is_difficulty(common::ron_api::Difficulty::Unknown) %}> - </option>
<option value="1" {%+ call is_difficulty(common::ron_api::Difficulty::Easy) %}>Easy</option>
<option value="2" {%+ call is_difficulty(common::ron_api::Difficulty::Medium) %}>Medium</option>
<option value="3" {%+ call is_difficulty(common::ron_api::Difficulty::Hard) %}>Hard</option>
</select>
<label for="select-language">Language</label>
<select id="select-language">
{% for lang in languages %}
<option value="{{ lang.1 }}"
{%+ if recipe.lang == lang.1 %}
selected
{% endif %}
>{{ lang.0 }}</option>
{% endfor %}
</select>
<input
id="input-is-published"
type="checkbox"
{%+ if recipe.is_published %}
checked
{% endif %}
>
<label for="input-is-published">Is published</label>
<div id="groups-container">
</div>
<input id="input-add-group" type="button" value="Add a group" />
<div id="hidden-templates">
<div class="group">
<label for="input-group-name">Name</label>
<input class="input-group-name" type="text" />
<label for="input-group-comment">Comment</label>
<input class="input-group-comment" type="text" />
<input class="input-group-delete" type="button" value="Remove group" />
<div class="steps"></div>
<input class="input-add-step" type="button" value="Add a step" />
</div>
<div class="step">
<label for="text-area-step-action">Action</label>
<textarea class="text-area-step-action"></textarea>
<input class="input-step-delete" type="button" value="Remove step" />
<div class="ingredients"></div>
<input class="input-add-ingredient" type="button" value="Add an ingredient"/>
</div>
<div class="ingredient">
<label for="input-ingredient-name">Name</label>
<input class="input-ingredient-name" type="text" />
<label for="input-ingredient-quantity">Quantity</label>
<input class="input-ingredient-quantity" type="number" step="0.1" min="0" max="10000" />
<label for="input-ingredient-unit">Unit</label>
<input class="input-ingredient-unit" type="text" />
<label for="input-ingredient-comment">Comment</label>
<input class="input-ingredient-comment" type="text" />
<input class="input-ingredient-delete" type="button" value="Remove ingredient" />
</div>
</div>
</div>
{% endblock %}