A bit of clean up

This commit is contained in:
Greg Burri 2025-03-02 00:39:58 +01:00
parent cb2483eab1
commit a590d7e1e9
24 changed files with 259 additions and 237 deletions

View file

@ -1,17 +1,18 @@
{% extends "base_with_header.html" %}
{% block main_container %}
<div class="content">
<div class="content" id="ask-reset-password">
<h1>{{ tr.t(Sentence::LostPassword) }}</h1>
<form action="/ask_reset_password" method="post">
<label for="email_field">{{ tr.t(Sentence::EmailAddress) }}</label>
<input id="email_field" type="email"
name="email" value="{{ email }}"
autocapitalize="none" autocomplete="email" autofocus="autofocus">
{{ message_email }}
<span class="user-message">{{ message_email }}</span>
<input type="submit" name="commit" value="{{ tr.t(Sentence::AskResetButton) }}">
</form>
{{ message }}
<span class="user-message">{{ message }}</span>
</div>
{% endblock %}

View file

@ -22,7 +22,7 @@
<select id="select-website-language">
{% for lang in translation::available_languages() %}
<option value="{{ lang.0 }}"
{%+ if tr.current_lang_code() == lang.0 %}
{%~ if tr.current_lang_code() == lang.0 %}
selected
{% endif %}
>{{ lang.1 }}</option>

View file

@ -18,13 +18,13 @@
autocapitalize="none"
autocomplete="title"
autofocus="autofocus">
<span></span>
<label for="input-email">{{ tr.t(Sentence::ProfileEmail) }}</label>
<input id="input-email" type="email"
name="email" value="{{ email }}"
autocapitalize="none" autocomplete="email" autofocus="autofocus">
{{ message_email }}
<span class="user-message">{{ message_email }}</span>
<label for="input-servings">{{ tr.t(Sentence::ProfileDefaultServings) }}</label>
<input
@ -33,18 +33,20 @@
step="1" min="1" max="100"
name="default_servings"
value="{{ default_servings }}">
<span></span>
<label for="input-password-1">{{ tr.tp(Sentence::ProfileNewPassword, [Box::new(common::consts::MIN_PASSWORD_SIZE)]) }}</label>
<input id="input-password-1" type="password" name="password_1" autocomplete="new-password">
<span></span>
<label for="input-password-2">{{ tr.t(Sentence::ReEnterPassword) }}</label>
<input id="input-password-2" type="password" name="password_2" autocomplete="new-password">
{{ message_password }}
<span class="user-message">{{ message_password }}</span>
<input type="submit" name="commit" value="{{ tr.t(Sentence::Save) }}">
</form>
{{ message }}
<span class="user-message">{{ message }}</span>
</div>
{% endif %}

View file

@ -42,10 +42,10 @@
<label for="select-difficulty">{{ tr.t(Sentence::RecipeDifficulty) }}</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) %}>{{ tr.t(Sentence::RecipeDifficultyEasy) }}</option>
<option value="2" {%+ call is_difficulty(common::ron_api::Difficulty::Medium) %}>{{ tr.t(Sentence::RecipeDifficultyMedium) }}</option>
<option value="3" {%+ call is_difficulty(common::ron_api::Difficulty::Hard) %}>{{ tr.t(Sentence::RecipeDifficultyHard) }}</option>
<option value="0" {%~ call is_difficulty(common::ron_api::Difficulty::Unknown) %}> - </option>
<option value="1" {%~ call is_difficulty(common::ron_api::Difficulty::Easy) %}>{{ tr.t(Sentence::RecipeDifficultyEasy) }}</option>
<option value="2" {%~ call is_difficulty(common::ron_api::Difficulty::Medium) %}>{{ tr.t(Sentence::RecipeDifficultyMedium) }}</option>
<option value="3" {%~ call is_difficulty(common::ron_api::Difficulty::Hard) %}>{{ tr.t(Sentence::RecipeDifficultyHard) }}</option>
</select>
<div id="container-tags">
@ -61,7 +61,7 @@
<select id="select-language">
{% for lang in translation::available_languages() %}
<option value="{{ lang.0 }}"
{%+ if recipe.lang == lang.0 %}
{%~ if recipe.lang == lang.0 %}
selected
{% endif %}
>{{ lang.1 }}</option>
@ -71,7 +71,7 @@
<input
id="input-is-published"
type="checkbox"
{%+ if recipe.is_published %}
{%~ if recipe.is_published %}
checked
{% endif %}
>

View file

@ -33,7 +33,7 @@
{% match recipe.estimated_time %}
{% when Some(time) %}
{{ time +}} {{+ tr.t(Sentence::RecipeEstimatedTimeMinAbbreviation) }}
{{ time ~}} {{~ tr.t(Sentence::RecipeEstimatedTimeMinAbbreviation) }}
{% else %}
{% endmatch %}
@ -65,10 +65,10 @@
{% for ingredient in step.ingredients %}
<div class="ingredient">
{% if let Some(quantity) = ingredient.quantity_value %}
{{ quantity +}}
{{+ ingredient.quantity_unit }}
{% endif +%}
{{+ ingredient.name }}
{{ quantity ~}}
{{~ ingredient.quantity_unit }}
{% endif ~%}
{{~ ingredient.name }}
</div>
{% endfor %}
</div>

View file

@ -1,48 +1,40 @@
{% macro recipe_item(id, title, class) %}
<a href="/recipe/view/{{ id }}" class="{{ class }}" id="recipe-{{ id }}">
{% if title == "" %}
{{ tr.t(Sentence::UntitledRecipe) }}
{% else %}
{{ title }}
{% endif %}
</a>
{% macro recipe_item(id, title, is_current) %}
<li>
<a href="/recipe/view/{{ id }}" class="recipe-item
{%~ if is_current %}
current
{% endif %}" id="recipe-{{ id }}"
>
{% if title == "" %}
{{ tr.t(Sentence::UntitledRecipe) }}
{% else %}
{{ title }}
{% endif %}
</a>
</li>
{% endmacro %}
<div id="recipes-list">
{% if !recipes.unpublished.is_empty() %}
{{ tr.t(Sentence::UnpublishedRecipes) }}
{{ tr.t(Sentence::UnpublishedRecipes) }}
{% endif %}
<nav class="recipes-list-unpublished">
<ul>
{% for (id, title) in recipes.unpublished %}
<li>
{% if recipes.is_current(id) %}
{% call recipe_item(id, title, "recipe-item-current") %}
{% else %}
{% call recipe_item(id, title, "recipe-item") %}
{% endif %}
</li>
{% call recipe_item(id, title, recipes.is_current(id)) %}
{% endfor %}
</ul>
</nav>
{% if !recipes.unpublished.is_empty() %}
<hr>
<hr>
{% endif %}
<nav class="recipes-list-published">
<ul>
{% for (id, title) in recipes.published %}
<li>
{% if recipes.is_current(id) %}
{% call recipe_item(id, title, "recipe-item-current") %}
{% else %}
{% call recipe_item(id, title, "recipe-item") %}
{% endif %}
</li>
{% call recipe_item(id, title, recipes.is_current(id)) %}
{% endfor %}
</ul>
</nav>

View file

@ -16,6 +16,7 @@
<input type="submit" value="{{ tr.t(Sentence::SignInMenu) }}">
</form>
<span class="user-message">{{ message }}</span>
</div>

View file

@ -12,17 +12,16 @@
name="email" value="{{ email }}"
autocapitalize="none" autocomplete="email" autofocus="autofocus"
>
<span class="user-message">{{ message_email }}</span>
<label for="input-password-1">
{{ tr.tp(Sentence::ChooseAPassword, [Box::new(common::consts::MIN_PASSWORD_SIZE)]) }}
</label>
<input id="input-password-1" type="password" name="password_1" autocomplete="new-password">
<span></span>
<label for="input-password-2">{{ tr.t(Sentence::ReEnterPassword) }}</label>
<input id="input-password-2" type="password" name="password_2" autocomplete="new-password">
<span class="user-message">{{ message_password }}</span>
<input type="submit" name="commit" value="{{ tr.t(Sentence::SignUpButton) }}">