diff options
Diffstat (limited to 'src/chef/pages/recipe.clj')
-rw-r--r-- | src/chef/pages/recipe.clj | 20 |
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 [:*] |