From 6c8b1c25521ac4c68d7e01dbf96fc6a8d9c24d17 Mon Sep 17 00:00:00 2001 From: Arne Brasseur Date: Tue, 3 Sep 2024 16:28:22 +0200 Subject: [PATCH] Fix join button on session page --- resources/public/css/styles.css | 6 ++++++ src/co/gaiwan/compass/db/queries.clj | 2 +- src/co/gaiwan/compass/html/sessions.clj | 13 ++++++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/resources/public/css/styles.css b/resources/public/css/styles.css index e55c0d6..74c6903 100644 --- a/resources/public/css/styles.css +++ b/resources/public/css/styles.css @@ -670,4 +670,10 @@ body { .sessions-session_form div.date-time { display: flex; gap: var(--size-2); +} + +.sessions-join_btn input { + color: var(--text-2); + background-color: var(--surface-3); + border-radius: var(--radius-2); } \ No newline at end of file diff --git a/src/co/gaiwan/compass/db/queries.clj b/src/co/gaiwan/compass/db/queries.clj index 27c7b0d..a4dfdd5 100644 --- a/src/co/gaiwan/compass/db/queries.clj +++ b/src/co/gaiwan/compass/db/queries.clj @@ -7,7 +7,7 @@ (defn session [id] (let [e (db/entity id)] - (-> (into {} e) + (-> (into {:db/id (:db/id e)} e) (update :session/type db/entity) (update :session/location db/entity) (assoc :session/signup-count (count (:session/participants e)))))) diff --git a/src/co/gaiwan/compass/html/sessions.clj b/src/co/gaiwan/compass/html/sessions.clj index 8e06e4d..d632efe 100644 --- a/src/co/gaiwan/compass/html/sessions.clj +++ b/src/co/gaiwan/compass/html/sessions.clj @@ -64,7 +64,7 @@ (declare session-card) -(o/defstyled participate-btn c/form +(o/defstyled join-btn c/form [:input {:color t/--text-2 :background-color t/--surface-3 :border-radius t/--radius-2}] @@ -72,10 +72,9 @@ ;; Progressive enhancement, without htmx the form submission will kick in [:<> {:method "POST" - :action (str "/sessions/" (:db/id session) "/participate")} + :action (url-for :session/participate {:id (:db/id session)})} [:input {:type "submit" - :hx-post (str "/sessions/" (:db/id session) "/participate") - :hx-indicator (str "closest ." session-card) + :hx-post (url-for :session/participate {:id (:db/id session)}) :hx-swap "none" :value (if (session/participating? session user) @@ -87,7 +86,7 @@ :mt-2 ([session user] [:<> - [participate-btn session user] + [join-btn session user] [:a.btn {:href (str "/sessions/" (:db/id session))} "Details"]])) @@ -156,7 +155,7 @@ [:div.left [session-image+guage session user] - [participate-btn session user]] + [join-btn session user]] [:div.details [:h2.title @@ -229,7 +228,7 @@ (when (:session/ticket-required? session) [:p "Ticket Required"]) [:div.actions - [participate-btn session user] + [join-btn session user] (when (or (user/admin? user) (session/organizing? session user)) [:<>