summaryrefslogtreecommitdiffstats
path: root/src/view
diff options
context:
space:
mode:
Diffstat (limited to 'src/view')
-rw-r--r--src/view/main.phel31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/view/main.phel b/src/view/main.phel
index 5d369ab..a47f308 100644
--- a/src/view/main.phel
+++ b/src/view/main.phel
@@ -20,16 +20,23 @@
[:a {:href "https://github.com/phel-lang/phel-lang"} "GitHub"]
[:a {:href "https://gitter.im/phel-lang/community"} "Community"]])
-(def- content
- [:div {:class "flex-center position-ref full-height"}
- [:form
- [:label {:for "title"} "Title: "]
- [:input {:type "text" :name "title"}]
- [:br]
- [:label {:for "authors"} "Author: "]
- [:input {:type "text" :name "author"}]]])
+(defn content [books]
+ (html
+ (doctype :html5)
+ [:html
+ head
+ [:body
+ [:ul
+ (for [book :in books]
+ [:li (:title book)])]
+ [:div {:class "flex-center position-ref full-height"}
+ [:form {:action "/book" :method "POST"}
+ [:label {:for "title"} "Title: "]
+ [:input {:type "text" :name "title"}]
+ [:br]
+ [:label {:for "authors"} "Author: "]
+ [:input {:type "text" :name "author"}]
+ [:input {:type "submit"}]]]]]))
-(def index-html (html
- (doctype :html5)
- head
- content))
+(defn index-html [books]
+ (content books))