mirror of
https://github.com/sigmasternchen/kukkubukku
synced 2025-03-15 07:18:54 +00:00
added tags to recipe page
This commit is contained in:
parent
d373f387b7
commit
a3e6e0c258
3 changed files with 20 additions and 1 deletions
|
@ -33,7 +33,9 @@ recipe() {
|
||||||
ingredients="$(echo "$result" | getColumns 3)"
|
ingredients="$(echo "$result" | getColumns 3)"
|
||||||
nrIngredients="$(echo "$qts" | wc -l)"
|
nrIngredients="$(echo "$qts" | wc -l)"
|
||||||
|
|
||||||
title=""
|
tags="$(getTagsByRecipeId "$id" | getColumns 1)"
|
||||||
|
|
||||||
|
title="$name"
|
||||||
content="$(template "templates/recipe.fragment.templ")"
|
content="$(template "templates/recipe.fragment.templ")"
|
||||||
template "templates/layout.html.templ"
|
template "templates/layout.html.templ"
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,18 @@ getRecipeById() {
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTagsByRecipeId() {
|
||||||
|
local id="$(echo "$1" | sed 's/[^0-9]//g')"
|
||||||
|
|
||||||
|
query <<EOF
|
||||||
|
SELECT DISTINCT name
|
||||||
|
FROM tags
|
||||||
|
INNER JOIN recipeTags
|
||||||
|
ON recipeTags.tagFk = tags.id
|
||||||
|
WHERE recipeFk = $id
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
addRecipe() {
|
addRecipe() {
|
||||||
local name="$1"
|
local name="$1"
|
||||||
local description="$2"
|
local description="$2"
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<h1>{{ print "$name" }}</h1>
|
<h1>{{ print "$name" }}</h1>
|
||||||
|
<ul>
|
||||||
|
{{ for t in $tags; do }}
|
||||||
|
<li>{{ print "$t" }}</li>
|
||||||
|
{{ done }}
|
||||||
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
from <a href="/profile?id={{ print "$uid" }}">{{ print "$author" }}</a>
|
from <a href="/profile?id={{ print "$uid" }}">{{ print "$author" }}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue