diff --git a/src/co/gaiwan/compass/db/data.clj b/src/co/gaiwan/compass/db/data.clj index 20e06a9..7d1a604 100644 --- a/src/co/gaiwan/compass/db/data.clj +++ b/src/co/gaiwan/compass/db/data.clj @@ -7,9 +7,26 @@ (defn locations [] [{:location/name "Het Depot" :db/ident :location.type/depot} + {:location/name "Het Depot - main stage" + :db/ident :location.type/depot-main-stage} + {:location/name "Het Depot - Bar" + :db/ident :location.type/depot-bar} {:location/name "Hal 5" :db/ident :location.type/hal5} - ]) + {:location/name "Hal 5 - zone A" + :db/ident :location.type/hal5-zone-a} + {:location/name "Hal 5 - zone B" + :db/ident :location.type/hal5-zone-b} + {:location/name "Hal 5 - HoC Café" + :db/ident :location.type/hal5-hoc-cafe} + {:location/name "Hal 5 - Foodcourt" + :db/ident :location.type/hal5-foodcourt} + {:location/name "Hal 5 - park" + :db/ident :location.type/hal5-park} + {:location/name "Hal 5 - outside seating" + :db/ident :location.type/hal5-outside-seating} + {:location/name "Hal 5 - long table" + :db/ident :location.type/hal5-long-table}]) (defn session-types [] [{:session.type/name "Talk" diff --git a/src/co/gaiwan/compass/db/schema.clj b/src/co/gaiwan/compass/db/schema.clj index a2ff671..8f6481b 100644 --- a/src/co/gaiwan/compass/db/schema.clj +++ b/src/co/gaiwan/compass/db/schema.clj @@ -24,6 +24,9 @@ [:session/location :ref "Where does the session take place"] [:session/image :string "Image URL, either absolute, or relative to compass root"] [:session/capacity :long "Number of people that are able to join this session"] + [:session/signup :long "Number of people that are currently signing up this session"] + [:session/ticket-required? :boolean "If this session requires a ticket"] + [:session/published? :boolean "If this session is published/visible?"] [:session.type/name :string "Type of session, e.g. talk, activity"] [:session.type/color :string "CSS color or var reference used for rendering"] diff --git a/src/co/gaiwan/compass/html/sessions.clj b/src/co/gaiwan/compass/html/sessions.clj index 792058c..80fc1a9 100644 --- a/src/co/gaiwan/compass/html/sessions.clj +++ b/src/co/gaiwan/compass/html/sessions.clj @@ -86,17 +86,13 @@ [:div [:label {:for "type"} "Type"] [:select {:id "type" :name "type"} - [:option {:value "talk"} "talk"] - [:option {:value "workshop"} "workshop"] - [:option {:value "keynote"} "keynote"] - [:option {:value "office-hours"} "office-hours"] - [:option {:value "session"} "session"]]] + [:option {:value "activity"} "activity"]]] [:div [:label {:for "location"} "Location"] [:select {:id "location" :name "location"} [:option {:value "depot-main-stage"} "Het Depot - main stage"] - [:option {:value "depot-baar"} "Het Depot - Bar"] + [:option {:value "depot-bar"} "Het Depot - Bar"] [:option {:value "hal5-zone-a"} "Hal 5 - zone A"] [:option {:value "hal5-zone-b"} "Hal 5 - zone B"] [:option {:value "hal5-hoc-cafe"} "Hal 5 - HoC Café"] @@ -114,8 +110,8 @@ [:textarea {:id "description" :name "description"}]] [:div - [:label {:for "requires_ticket"} "Requires Ticket?"] - [:input {:id "requires_ticket" :name "requires-ticket?" :type "checkbox"}]] + [:label {:for "ticket"} "Requires Ticket?"] + [:input {:id "ticket" :name "ticket-required?" :type "checkbox"}]] [:div [:label {:for "published"} "Published/Visible?"] diff --git a/src/co/gaiwan/compass/routes/sessions.clj b/src/co/gaiwan/compass/routes/sessions.clj index e80723d..e062c88 100644 --- a/src/co/gaiwan/compass/routes/sessions.clj +++ b/src/co/gaiwan/compass/routes/sessions.clj @@ -18,16 +18,35 @@ {:html/head [:title "Create new session"] :html/body [h/session-form {}]})) +(defn params->session-data + "convert the Http Post Params to data ready for DB transaction" + [{:keys [name description + type location + capacity + ticket-required? published?]}] + (cond-> {:session/title name + :session/description description + :session/type (keyword "session.type" type) + :session/location (keyword "location.type" location) + :session/capacity (Integer/parseInt capacity)} + (= ticket-required? "on") + (assoc :session/ticket-required? true) + (= published? "on") + (assoc :session/published? true))) + (defn save-session "Save session to Datomic The typical params is: - {:name \"dsafa\", :type \"talk\", - :location \"depot-main-stage\", :capacity \"34\", - :description \"dsafa\", :requires-ticket? \"on\" + {:name \"dsafa\", + :description \"dsafa\", + :type \"activity\", + :location \"depot-main-stage\", + :capacity \"34\", + :ticket-required? \"on\" :published? \"on\"}" [{:keys [params]}] - ;; TODO save to datomic + (db/transact [(params->session-data params)]) {:html/body [:p "OK " (pr-str params)]}) (defn routes []