src/views/blog-main.lisp
(defpackage murja.views.blog-main
(:use :cl :murja.views.components.root :murja.views.components.tab)
(:import-from :cl-hash-util :hash)
(:import-from :murja.routes.root-routes :@check-if-initial)
(:import-from :murja.routes.settings-routes :get-settings)
(:import-from :murja.middleware.db :@transaction)
(:import-from :murja.posts.post-db :get-titles-by-year :get-page )
(:import-from :murja.newui :@newui :c :with-state)
(:import-from :easy-routes :defroute))
(in-package :murja.views.blog-main)
(defroute blog-root-view ("/blog/" :method :get
:decorators (@newui @transaction @check-if-initial)) ()
(let* ((settings (get-settings))
(page-size (gethash "recent-post-count" settings))
(page 1)
(page-posts (get-page page page-size))
(sidebar-titles (get-titles-by-year)))
(root-component
(tabs "Home"
(hash
("Home"
(c :p () "Welcome to murja I guess.... :D"))
("Ilpo testaa"
(c :p () "Kakkos tabi"))
("Kolmas tabi"
(c :form ()
(c :label ()
"Testi inputti"
(c :input (:type "text" :value "Koodista tuleva oletushomma"))))))))))