diff options
author | Griffin Smith <grfn@gws.fyi> | 2021-12-19T17·30-0500 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2021-12-19T17·33+0000 |
commit | 1b0ec2a6d694dca0f22d6e0c102785b229b25f17 (patch) | |
tree | 98e7d58e18910e454b8973293abf47d5aa0820d3 /users/grfn/bbbg/src/bbbg/handlers/attendees.clj | |
parent | 9af35bd683228f2c039e1dd39cde3f72749bd112 (diff) |
feat(grfn/bbbg): Add an attendee search form r/3309
Change-Id: I6f4d5102c1d3a36cb706a637196a2053739003bb Reviewed-on: https://cl.tvl.fyi/c/depot/+/4502 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'users/grfn/bbbg/src/bbbg/handlers/attendees.clj')
-rw-r--r-- | users/grfn/bbbg/src/bbbg/handlers/attendees.clj | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/users/grfn/bbbg/src/bbbg/handlers/attendees.clj b/users/grfn/bbbg/src/bbbg/handlers/attendees.clj index 3db7f04d9085..b6846c1f3c44 100644 --- a/users/grfn/bbbg/src/bbbg/handlers/attendees.clj +++ b/users/grfn/bbbg/src/bbbg/handlers/attendees.clj @@ -12,11 +12,12 @@ [ring.util.response :refer [content-type redirect response]] [bbbg.views.flash :as flash])) -(defn- attendees-page [{:keys [attendees]}] +(defn- attendees-page [{:keys [attendees q]}] [:div [:form.search-form {:method :get :action "/attendees"} [:input {:type "search" - :name "q"}] + :name "q" + :value q}] [:input {:type "submit" :value "Search Attendees"}]] [:table.attendees @@ -40,9 +41,11 @@ (routes (wrap-auth-required (routes - (GET "/attendees" [] - (let [attendees (db/list db (db.attendee/with-stats))] - (page-response (attendees-page {:attendees attendees})))))) + (GET "/attendees" [q] + (let [attendees (db/list db (cond-> (db.attendee/with-stats) + q (db.attendee/search q)))] + (page-response (attendees-page {:attendees attendees + :q q})))))) (GET "/attendees.json" [q event_id attended] (let [results |