From aaf4304c7cf6259fc00366608ce643cf9697a887 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 25 May 2025 16:00:21 +0200 Subject: Make categories editable; TODO: store the root question --- src/chef/pages/admin.clj | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/chef/pages/admin.clj') diff --git a/src/chef/pages/admin.clj b/src/chef/pages/admin.clj index 83e5dbd..031da8c 100644 --- a/src/chef/pages/admin.clj +++ b/src/chef/pages/admin.clj @@ -8,17 +8,24 @@ (defn- render-category [data children] [:li - [:p {:style {:display :inline-block}} (if (some? data) - [:input {:type :text :placeholder "Name" - :value (:categories/name data)}] - "Startseite")] + [:p {:style {:display :inline-block}} + (if (some? data) + [:input {:type :text :placeholder "Name" + :value (:categories/name data) + :name "name" + :hx-post (str "/api/admin/edit-category/" (:categories/id data)) + :hx-trigger "change"}] + "Startseite")] [:p {:style {:display :inline-block :margin-left "1em" :margin-right "1em"}} "->"] - [:input {:type :text :placeholder "Frage" - :style {:display :inline-block - :width :auto} - :value (:category/name data)}] ; TODO: only show when category has children + [:input {:type :text :placeholder "Frage" + :style {:display :inline-block + :width :auto} + :value (:categories/question data) + :name "question" + :hx-post (str "/api/admin/edit-category/" (:categories/id data)) + :hx-trigger "change"}] ; TODO: only show when category has children [:img {:src "/static/icons/plus.svg" :height "30em" :style {:vertical-align :middle :margin-left "1em"} -- cgit v1.2.3