From f10765778208840e4dd675646041305ad6b17861 Mon Sep 17 00:00:00 2001 From: xengineering <me@xengineering.eu> Date: Wed, 6 Mar 2024 19:17:07 +0100 Subject: view: Make recipe portions, URL and notes optional An empty string for one of these attributes will lead to a recipe view page which does not render the paragraph for this item. --- view/html/recipe.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/view/html/recipe.html b/view/html/recipe.html index bce4ffa..356abda 100644 --- a/view/html/recipe.html +++ b/view/html/recipe.html @@ -7,10 +7,10 @@ <h1>{{.Title}}</h1> </header> <body> - <main> - <p>Portions: {{.Portions}}</p> - <p><a href="{{.Url}}">original recipe</a></p> - <p>{{.Notes}}</p> + <main>{{ if ne .Portions "" }} + <p>Portions: {{.Portions}}</p>{{end}}{{ if ne .Url "" }} + <p><a href="{{.Url}}">original recipe</a></p>{{end}}{{ if ne .Notes "" }} + <p>{{.Notes}}</p>{{end}} <a href="/recipe/{{.Id}}?view=recipe-edit"><button>edit</button></a> <a href="/recipe/{{.Id}}?view=recipe-confirm-deletion"><button style="background-color:red">delete</button></a> </main> -- cgit v1.2.3-70-g09d2