summaryrefslogtreecommitdiff
path: root/src/chef/pages/recipe.clj
diff options
context:
space:
mode:
authorTim <contact@bytim.eu>2025-06-01 22:02:24 +0200
committerTim <contact@bytim.eu>2025-06-01 22:02:24 +0200
commitf030a32679e7291eeb3ec4925a6354767bed3694 (patch)
tree5bf5f32dc45767319f63029f0d01696b20881e2c /src/chef/pages/recipe.clj
parentffb5d0b740e3fa23143ad89dab29a44d5b0acd34 (diff)
downloadchef-f030a32679e7291eeb3ec4925a6354767bed3694.tar.xz
chef-f030a32679e7291eeb3ec4925a6354767bed3694.zip
Add content to recipe page
Diffstat (limited to 'src/chef/pages/recipe.clj')
-rw-r--r--src/chef/pages/recipe.clj20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/chef/pages/recipe.clj b/src/chef/pages/recipe.clj
index 71dd4b2..f1c1a21 100644
--- a/src/chef/pages/recipe.clj
+++ b/src/chef/pages/recipe.clj
@@ -1,6 +1,7 @@
(ns chef.pages.recipe
(:require [chef.database :as cdb]
[chef.utils :as cutils]
+ [clojure.string :as cstr]
[hiccup2.core :as html]
[honey.sql :as sql]
[next.jdbc :as jdbc]
@@ -19,7 +20,24 @@
sql/format
(jdbc/execute! @cdb/db)
first))]]
- [:b "TODO"]]))
+ [:h2 (str "Zutaten"
+ (condp = (:recipes/unit recipe)
+ 0 " pro Portion"
+ 1 " pro Person"
+ "")
+ ":")]
+ [:ul (for [ingredient (-> recipe
+ :recipes/ingredients
+ cutils/parse-ingredients)]
+ [:li
+ [:b (:description ingredient)] ": "
+ (:amount ingredient) (:unit ingredient)])]
+ [:h2 "Zubereitung"]
+ (->> (:recipes/preparation recipe)
+ cstr/split-lines
+ (map #(if (cstr/blank? %)
+ [:br]
+ [:p %])))]))
(defn handler [req]
(->> {:select [:*]