summaryrefslogtreecommitdiffstats
path: root/src/view
diff options
context:
space:
mode:
authorGravatar Tom Willemse2026-08-25 01:10:35 -0700
committerGravatar Tom Willemse2026-08-25 01:10:35 -0700
commit2d9a5a31676d2886a42e34170706a78d93ce1f18 (patch)
tree327bcdc8ea0005b36b70ebf8caa1062c221c733b /src/view
parent94a7f1fc01ec27f85853294c167c1ca05c3269b8 (diff)
downloadlezer-2d9a5a31676d2886a42e34170706a78d93ce1f18.tar.gz
lezer-2d9a5a31676d2886a42e34170706a78d93ce1f18.zip
Add authors
Diffstat (limited to 'src/view')
-rw-r--r--src/view/main.phel15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/view/main.phel b/src/view/main.phel
index a47f308..1be6226 100644
--- a/src/view/main.phel
+++ b/src/view/main.phel
@@ -1,5 +1,7 @@
(ns lezer.view.main
- (:require phel.html :refer [html doctype]))
+ (:require phel.html :refer [html doctype])
+ (:require phel.pdo)
+ (:require phel.string :as str))
(def- head
[:head
@@ -27,14 +29,19 @@
head
[:body
[:ul
- (for [book :in books]
- [:li (:title book)])]
+ (for [b :in books]
+ (let [authors (:authors b)
+ book (:book b)]
+ [:li (:title book)
+ (if (not (empty? authors))
+ (str " by "
+ (str/join ", " (map :name authors))))]))]
[: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: "]
+ [:label {:for "author"} "Author: "]
[:input {:type "text" :name "author"}]
[:input {:type "submit"}]]]]]))