Makes reports page work with new tailwind

This commit is contained in:
2023-05-12 15:17:54 -07:00
parent e78c73e093
commit 8dca622947
13 changed files with 540 additions and 296 deletions

View File

@@ -2,7 +2,8 @@
(:require
[auto-ap.logging :as alog]
[config.core :refer [env]]
[hiccup2.core :as hiccup]))
[hiccup2.core :as hiccup]
[clojure.string :as str]))
(defn html-response [hiccup & {:keys [status headers] :or {status 200 headers {}}}]
{:status status
@@ -39,3 +40,24 @@
(ex-message e)]
:status 500)))))))
(defn form-data->map [form-data]
(reduce-kv
(fn [acc k v]
(cond (and (string? v)
(empty? v))
acc
:else
(assoc-in acc (->> (str/split k #"_")
(mapv #(apply keyword (str/split % #"/"))))
v)))
{}
form-data))
(defn path->name [k]
(cond (keyword? k)
(str (namespace k) "/" (name k))
(seq k)
(str/join "_" (map path->name k))
:else k))