diff options
author | Tim <contact@bytim.eu> | 2025-05-25 16:51:34 +0200 |
---|---|---|
committer | Tim <contact@bytim.eu> | 2025-05-25 16:51:34 +0200 |
commit | d1699f9af8cb7457f248bf71197535221f3d9472 (patch) | |
tree | 0980493e5be38f2bd6ea96377c6c77a1b52c47ae /src/chef/pages/admin.clj | |
parent | 3c4f9feb1a9ef05f1175c3cd6c16081e4ebabd4b (diff) | |
download | chef-d1699f9af8cb7457f248bf71197535221f3d9472.tar.xz chef-d1699f9af8cb7457f248bf71197535221f3d9472.zip |
Do not allow deleting root category
Diffstat (limited to 'src/chef/pages/admin.clj')
-rw-r--r-- | src/chef/pages/admin.clj | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/chef/pages/admin.clj b/src/chef/pages/admin.clj index 859dda4..e38dac3 100644 --- a/src/chef/pages/admin.clj +++ b/src/chef/pages/admin.clj @@ -39,11 +39,12 @@ :hx-post (str "/api/admin/create-category" (when (pos? (:categories/id data)) (str "?parent=" (:categories/id data)))) :hx-swap "none"}] - [:img {:src "/static/icons/trash.svg" :height "30em" - :style {:vertical-align :middle - :margin-left "1em"} - :hx-delete (str "/api/admin/delete-category/" (:categories/id data)) - :hx-swap "none"}] + (when (pos? (:categories/id data)) + [:img {:src "/static/icons/trash.svg" :height "30em" + :style {:vertical-align :middle + :margin-left "1em"} + :hx-delete (str "/api/admin/delete-category/" (:categories/id data)) + :hx-swap "none"}]) [:ul (for [child children] (render-category child (->> (sql/format {:select [:*] |