src/views/components/post.lisp
(defpackage murja.views.components.post
(:use :cl :murja.newui :cl-hash-util :binding-arrows :murja.models.user )
(:import-from :murja.models.post :post-id :post-title :creator :created-at :article :previous-post-id :next-post-id)
(:export :post))
(in-package :murja.views.components.post)
(defun post (post &key show-footer?)
(let ((creator (creator post)))
(c :article (:class "post")
(c :h2 ()
(c :a (:href (format nil "/blog/post/~d" (post-id post)))
(post-title post)))
(c :section (:class "meta")
(c :img (:class "user_avatar" :src (user-img-location creator)))
(c :p () (format nil "By ~a" (user-nickname creator)))
(c :p () "Written at"
(c :time (:datetime (created-at post))
(created-at post))))
(c :section (:class "content") (article post))
(when (and show-footer?
(or (not (equalp -1 (previous-post-id post)))
(not (equalp -1 (next-post-id post)))))
(c :footer (:class "linear-post-footer-nav")
(unless (equalp -1 (previous-post-id post))
(c :a (:href (format nil "/blog/post/~d" (previous-post-id post)))
"Older post"))
(unless (equalp -1 (next-post-id post))
(c :a (:href (format nil "/blog/post/~d" (next-post-id post)))
"Newer post")))))))