Skip to content

Commit

Permalink
Fix join button on session page
Browse files Browse the repository at this point in the history
  • Loading branch information
plexus committed Sep 3, 2024
1 parent ec7f833 commit 6c8b1c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions resources/public/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion src/co/gaiwan/compass/db/queries.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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))))))
Expand Down
13 changes: 6 additions & 7 deletions src/co/gaiwan/compass/html/sessions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,17 @@

(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}]
([session user]
;; 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)
Expand All @@ -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"]]))

Expand Down Expand Up @@ -156,7 +155,7 @@

[:div.left
[session-image+guage session user]
[participate-btn session user]]
[join-btn session user]]

[:div.details
[:h2.title
Expand Down Expand Up @@ -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))
[:<>
Expand Down

0 comments on commit 6c8b1c2

Please sign in to comment.