From 94a7f1fc01ec27f85853294c167c1ca05c3269b8 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 24 Aug 2026 00:21:43 -0700 Subject: Add simplistic database This doesn't include a full database, or even a secure one, but this is the first step into moving forward with this project. I can now write to and read from a database. --- src/view/main.phel | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/view') 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)) -- cgit v1.3-2-g0d8e