Service for editing/creating recipe

Other stuff...
This commit is contained in:
Greg Burri 2022-12-15 01:13:57 +01:00
parent adcf4a5a5d
commit cc2e5b6893
15 changed files with 323 additions and 146 deletions

View file

@ -4,10 +4,9 @@
<div class="header-container">
<a class="title" href="/">~~ Recettes de cuisine ~~</a>
<span class="create-recipe">Create a new recipe</span>
{% match user %}
{% when Some with (user) %}
<a class="create-recipe" href="/recipe/new" >Create a new recipe</a>
<span>{{ user.email }} / <a href="/signout" />Sign out</a></span>
{% when None %}
<span><a href="/signin" >Sign in</a> / <a href="/signup">Sign up</a></span>

View file

@ -2,17 +2,14 @@
{% block content %}
<h2 class="recipe-title" >{{ current_recipe.title }}</h2>
<label for="title_field">Title</label>
<input id="title_field" type="text" name="title" value="{{ current_recipe.title }}" autocapitalize="none" autocomplete="title" autofocus="autofocus" />
{% match current_recipe.description %}
{% when Some with (description) %}
<div class="recipe-description" >
{{ description|markdown }}
</div>
{% when None %}
{% endmatch %}
<input
id="title_field"
type="text"
name="title"
value="{{ current_recipe.title }}"
autocapitalize="none"
autocomplete="title"
autofocus="autofocus" />
{% endblock %}

View file

@ -4,12 +4,15 @@
<h2 class="recipe-title" >{{ current_recipe.title }}</h2>
{% match current_recipe.description %}
{% when Some with (description) %}
<div class="recipe-description" >
{{ description|markdown }}
</div>
{% when None %}
{% endmatch %}
{% if user.is_some() && current_recipe.user_id == user.as_ref().unwrap().id %}
<a class="edit-recipe" href="/recipe/edit/{{ current_recipe.id }}" >Edit</a>
{% endif %}
{% if !current_recipe.description.is_empty() %}
<div class="recipe-description" >
{{ current_recipe.description.clone()|markdown }}
</div>
{% endif %}
{% endblock %}