From a3e6e0c25803cf9c8ab49a60e425412ca1178d17 Mon Sep 17 00:00:00 2001 From: overflowerror Date: Thu, 31 Mar 2022 21:00:39 +0200 Subject: [PATCH] added tags to recipe page --- controller/home.sh | 4 +++- data/recipes.sh | 12 ++++++++++++ templates/recipe.fragment.templ | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/controller/home.sh b/controller/home.sh index b2f603d..ab1d975 100644 --- a/controller/home.sh +++ b/controller/home.sh @@ -33,7 +33,9 @@ recipe() { ingredients="$(echo "$result" | getColumns 3)" nrIngredients="$(echo "$qts" | wc -l)" - title="" + tags="$(getTagsByRecipeId "$id" | getColumns 1)" + + title="$name" content="$(template "templates/recipe.fragment.templ")" template "templates/layout.html.templ" } diff --git a/data/recipes.sh b/data/recipes.sh index f7d1bcc..845b344 100644 --- a/data/recipes.sh +++ b/data/recipes.sh @@ -35,6 +35,18 @@ getRecipeById() { EOF } +getTagsByRecipeId() { + local id="$(echo "$1" | sed 's/[^0-9]//g')" + + query <{{ print "$name" }} +

from {{ print "$author" }}