Service for editing/creating recipe
[recipes.git] / backend / templates / view_recipe.html
index 1a5ba52..aba5c69 100644 (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 %}
\ No newline at end of file