diff options
author | Tim <contact@bytim.eu> | 2025-05-31 17:03:51 +0200 |
---|---|---|
committer | Tim <contact@bytim.eu> | 2025-05-31 17:03:51 +0200 |
commit | ffb5d0b740e3fa23143ad89dab29a44d5b0acd34 (patch) | |
tree | 1c4ff1d69bbf81a0a3dfe7c2c2bf1f5cd3e867ad /src/chef/pages/recipe.clj | |
parent | ea7b0078478ba7925f2db3cb1fa038e8a3d85ab8 (diff) | |
download | chef-ffb5d0b740e3fa23143ad89dab29a44d5b0acd34.tar.xz chef-ffb5d0b740e3fa23143ad89dab29a44d5b0acd34.zip |
Add real data to home page + add search logic + add recipe pages
Diffstat (limited to 'src/chef/pages/recipe.clj')
-rw-r--r-- | src/chef/pages/recipe.clj | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/chef/pages/recipe.clj b/src/chef/pages/recipe.clj new file mode 100644 index 0000000..71dd4b2 --- /dev/null +++ b/src/chef/pages/recipe.clj @@ -0,0 +1,34 @@ +(ns chef.pages.recipe + (:require [chef.database :as cdb] + [chef.utils :as cutils] + [hiccup2.core :as html] + [honey.sql :as sql] + [next.jdbc :as jdbc] + [ring.util.response :as ruresp])) + +(defn- render [recipe] + (cutils/gen-page (str "chef - " (:recipes/title recipe)) + [:div {:style {:margin-left "1em"}} + [:div + [:h1 {:style {:display :inline-block + :margin-right "0.5em"}} + (:recipes/title recipe)] + [:i (cutils/category-path (->> {:select [:*] + :from [:categories] + :where [:= :id (:recipes/category recipe)]} + sql/format + (jdbc/execute! @cdb/db) + first))]] + [:b "TODO"]])) + +(defn handler [req] + (->> {:select [:*] + :from [:recipes] + :where [:= :id (get-in req [:path-params :id])]} + sql/format + (jdbc/execute! @cdb/db) + first + render + html/html + str + ruresp/response)) |