Permalink
Browse files

Created a reservations new page

  • Loading branch information...
1 parent ead722e commit a0690c909786922853487d1b35b9677ef9c0ba96 David Davis committed Aug 11, 2012
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/shared_resource/views/reservations.clj
@@ -17,4 +17,21 @@
[:div.user (:user/name (:user reservation))]]))
(defpartial reservation-list [reservations]
- [:div.reservations (map reservation-div reservations)])
+ [:div.reservations (map reservation-div reservations)])
+
+(defpartial new-reservation-page [start end resource]
+ [:div.new-reservation])
+
+;; Routes
+
+(defpage "/reservations/new" []
+ (new-reservation-page "" "" ""))
+
+(defpage [:post "/reservations"] {:keys [start end resource]}
+ (if (reservation/create-reservation resource (session/get :user) start end)
+ (do
+ (session/flash-put! :success "Successfully create reservation.")
+ (resp/redirect (str "/resources/" resource)))
+ (do
+ (session/flash-put! :error "Failed to log in.")
+ (new-reservation-page start end resource))))

0 comments on commit a0690c9

Please sign in to comment.