Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 23 lines (20 sloc) 0.591 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
(ns foreclojure.golf
  (:use hiccup.form-helpers
        hiccup.page-helpers
        [foreclojure utils config]
        compojure.core
        somnium.congomongo)
  (:require [ring.util.response :as response]))

(def-page golfer-page []
  "Your preferences have been saved.")

(defn set-golfer [opt-in]
  (with-user [{:keys [_id]}]
    (update! :users
             {:_id _id}
             {:$set {:golfer (boolean opt-in)}})
    (response/redirect "/golf/opt-in")))

(defroutes golf-routes
  (POST "/golf/opt-in" [opt-in]
    (set-golfer opt-in))
  (GET "/golf/opt-in" []
    (golfer-page)))
Something went wrong with that request. Please try again.