Add not allowed and a basic submission form

parent de514418
......@@ -36,6 +36,14 @@
(lambda (p)
(write-json json p))))
(define (not-allowed)
(response
405 #"Method Not Allowed"
(current-seconds) #"text/plain"
'()
(lambda (out-port)
(write-bytes #"405 Method Not Allowed :P" out-port))))
;;; Some parameters
;;; ===============
......@@ -93,7 +101,9 @@
[else
(render-ok
(generic-base-tmpl
`(p "Hi there! This is " ,(users-name) "'s site.")))])]))
`(div ,(post-note-form)
(p "Hi there! This is " ,(users-name) "'s site."))))])]
[_ (not-allowed)]))
(define (inbox req)
(match (request-method req)
......@@ -102,7 +112,8 @@
(generic-base-tmpl
'(p "Inbox goes here!")))]
[#"POST"
'TODO]))
'TODO]
[_ (not-allowed)]))
(define (outbox req)
(match (request-method req)
......@@ -111,7 +122,8 @@
(generic-base-tmpl
'(p "Outbox goes here!")))]
[#"POST"
'TODO]))
'TODO]
[_ (not-allowed)]))
(define (post-note req)
'TODO)
......@@ -177,6 +189,25 @@
`(div (@ (class "simple-centered-wrap"))
,(apply generic-content-tmpl content)))
(define (post-note-form)
`(div (@ (class "simple-centered-wrap"))
(div (@ (class "post-new-note")
(style "max-width: 500px; min-width: 50%;"))
(h2 "What's up?")
(form (@ (action ,(golem-url post-note))
(method "POST")
(enctype "application/x-www-form-urlencoded"))
(div (@ (style "display: flex; width: 100%"))
(b "To: ")
(input (@ (type "text")
(name "to")
(style "flex: 2"))))
(textarea (@ (name "content")
(style "width: 100%; resize: none; height: 8em;")))
(div (@ (style "text-align: right"))
(button (@ (type "submit"))
"Submit"))))))
;;; Application launching
;;; =====================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment