arie741/zenlive — pull request #2 by arie741 (2014-10-15 04:31:46+00:00)
Title: add cp page

So i wanted to create a new page named cp.
In it, there are input forms quote and persons which control the contents of the zenquote in the homepage.

```clojure
(ns zenlive.routes
(:require [compojure.core :refer :all]
[zenlive.layout :as page]
[zenlive.pages.ctrl :as pages]
[noir.response :as resp]
))

(defroutes home
(GET "/" req
(pages/homepage))
(GET "/sign-in" req
(pages/signinpage))
(GET "/sign-up" req
(pages/signuppage))
(GET "/cp" req
(pages/cppage))
(POST "/cp" req
(pages/addquote (:params req)))
(POST "/sign-up" req
(do (signup/addacc (:params req))
(resp/redirect "/")))
)
```
```clojure
(ns zenlive.pages.cp
(:require [net.cgrand.enlive-html :as html]
[questdb.core :refer :all]))

(def qdb "quotedb")

(html/deftemplate cp "selmer/cp.html"
[])

```
```clojure
(ns zenlive.pages.ctrl
(:require [net.cgrand.enlive-html :as html]
[zenlive.pages.pagelayout :refer :all]
[questdb.core :refer :all]
[zenlive.pages.homepage :refer :all]
[zenlive.pages.signin :refer :all]
[zenlive.pages.signup :refer :all]
[zenlive.pages.cp :refer :all]))

;;Pages

(def ctitle " - zenius.net | The next revolution in learning")

;;homepage
(defn homepage []
(createpage home (str "Home" ctitle)))

;;Control Panel page
(defn cppage []
(createpage cp (str "Control Panel" ctitle)))

(defn addquote [q]
(put-doc! qdb q))

;;signup page
(defn signuppage []
(createpage signup (str "Sign-Up" ctitle)))

;;signin page
(defn signinpage []
(createpage signin (str "Sign-in" ctitle)))
```

There's some error involving sign-up routes and addacc function (in the ns zenlive.pages.signup)
so i disabled the sign-up post routes and disabled the database db

```clojure

(defroutes home
(GET "/" req
(pages/homepage))
(GET "/sign-in" req
(pages/signinpage))
(GET "/sign-up" req
(pages/signuppage))
(GET "/cp" req
(pages/cppage))
(POST "/cp" req
(pages/addquote (:params req)))
;; (POST "/sign-up" req
;; (do (signup/addacc (:params req))
;; (resp/redirect "/")))
)

```

```clojure
(ns zenlive.pages.signup
(:require [net.cgrand.enlive-html :as html]
[questdb.core :refer :all]))

;;(def db "zenlivedb")

(html/deftemplate signup "selmer/signup.html"
[])

;;(defn addacc [par]
;; (put-doc! db par))

```

but the addquote and cp routes still doesn't work.