(ns chef.pages.admin (:require [chef.utils :as cutils] [hiccup2.core :as html] [ring.util.response :as ruresp])) (defn- render [] (cutils/gen-page "chef - Admin" [:h1 "chef - Admin"] [:h2 "Kategorien"] ;;TODO: add delete icons to non-root categories [:ul [:li [:p {:style {:display :inline-block}} "Startseite"] [:p {:style {:display :inline-block :margin-left "1em" :margin-right "1em"}} "->"] [:input {:type :text :placeholder "Frage" :style {:display :inline-block :width :auto}}] ; TODO: only show when category has children [:img {:src "/static/icons/plus.svg" :height "30em" :style {:vertical-align :middle :margin-left "1em"} :hx-post "/api/admin/create-category" :hx-swap "none"}]]] [:h2 "Rezepte"] [:i "Coming soon..."])) (defn handler [req] (let [access-token (get-in req [:oauth2/access-tokens :auth]) resp (-> (render) html/html str ruresp/response)] (if (some? access-token) (assoc resp :session (assoc (:session req) :oauth-token access-token)) (cutils/auth-only req resp))))