               (label "body" "Body:") [:br]
               (text-area {:cols 80 :rows 40} "body" body) [:br]
               (submit-button "Submit"))))
-                                 
+
 (defn admin-add-page
   "Displays the Ackbar Admin 'Add Page' Page"
   []

   "All Pages"
   (for [page pages]
     [:div [:h1 (:title page)]
     [:div (:body page)]])))
                    
(defroutes ackbar-app-handler
  (GET "/" [] (render-page "home"))
  (GET "/admin/add" [] (admin-add-page))
  (GET "/admin/pages" [] (admin-page-list))
  (POST "/admin/add" {params :params}
        (add-page (params "title") (params "body")))
  (GET "/admin/edit/:title" [title] (admin-edit-page title))
  (POST "/admin/edit" {params :params}
        (edit-page (params "title") (params "body")))
  (POST "/admin/delete/:title" [title] (delete-page title))
  (GET "/all" [] (all-pages))
  (GET "/:title" [title] (render-page (canonical-title title)))
  (ANY "*" [] (response-wrapper "404" "NOT FOUND!" 404)))



(defn render-page
  "Retrieve a page from the datastore and render it for display to the user"
  [url]
  (try
    (response-wrapper url (:body (ds/retrieve Page url)))
    (catch EntityNotFoundException _
      (response-wrapper "404" (str "Unable to find page: " url) 404))))

(defn add-or-edit-form
  "Returns a form to add or edit a page."
