diff of e92efc91cdbe99cbb8422adbd56145ea5b92727c
e92efc91cdbe99cbb8422adbd56145ea5b92727c
diff --git a/aggressive-murja.asd b/aggressive-murja.asd
index 0c4ea18..3510b20 100644
--- a/aggressive-murja.asd
+++ b/aggressive-murja.asd
@@ -97,7 +97,8 @@
((:file "newui-dispatcher")))
(:file "blog-main")
- (:file "blog-post")))
+ (:file "blog-post")
+ (:file "blog-list-posts")))
(:file "main"))))
:in-order-to ((test-op (test-op "aggressive-murja/tests"))))
diff --git a/src/views/blog-list-posts.lisp b/src/views/blog-list-posts.lisp
new file mode 100644
index 0000000..be19e51
--- /dev/null
+++ b/src/views/blog-list-posts.lisp
@@ -0,0 +1,46 @@
+(defpackage murja.views.blog-list-posts
+ (:use :cl :murja.newui.dispatcher :murja.newui)
+ (:local-nicknames (:json :com.inuoe.jzon))
+ (:documentation "This package implements endpoints and components for the admin's post list"))
+
+(in-package :murja.views.blog-list-posts)
+
+(deftab /blog/postadmin (:route "/blog/postadmin"
+ :require-login t
+ :title "Manage posts"
+ :needed-abilities (list "edit-post"))
+ (let ((titles (postmodern:query "SELECT title, created_at, tags, unlisted, hidden
+FROM blog.Post
+ORDER BY created_at DESC" :array-hash))) ;; :array-hash due to me not caring enough to model this blog.Post Light as a clos class
+
+ (component :div (:class "vertical-flex-container")
+ (map 'list
+ (lambda (title)
+ (c :div (:class "title-flex-container")
+ (c :span (:class "post-admin-title")
+ (gethash "title" title)
+ " - "
+ (gethash "created_at" title))
+ (c :div (:class "post-admin-title")
+ (c :label ()
+ (if (gethash "hidden" title)
+ (c :input (:type "checkbox"
+ :checked t ))
+ (c :input (:type "checkbox"
+ :unchecked)))
+ "Hidden")
+ (c :label ()
+ (if (gethash "unlisted" title)
+ (c :input (:type "checkbox"
+ :checked t ))
+ (c :input (:type "checkbox"
+ :unchecked)))
+ "Unlisted"))
+ (c :a (:href "/") "Edit")
+ (component :div (:class "post-admin-title")
+ (concatenate 'list
+ (list (c :h3 () "Tags"))
+ (map 'list (lambda (tag)
+ (c :a (:href (format nil "/blog/tags/~a" tag) :style "display: block") tag))
+ (json:parse (gethash "tags" title)))))))
+ titles))))
diff --git a/src/views/blog-main.lisp b/src/views/blog-main.lisp
index e646a7a..9f19e2b 100644
--- a/src/views/blog-main.lisp
+++ b/src/views/blog-main.lisp
@@ -34,9 +34,5 @@
(with-state (
(page-posts (murja.models.post:get-page page page-size))) ()
- ;; (when *user*
- ;; (setf (gethash "Secret logged in user tab" tabs-spec)
- ;; (c :div () (format nil "Welcome ~a" (user-nickname *user*)))))
-
(c :div ()
(murja.views.components.page:page page-posts)))))