diff of 4c075bc85801af9ec5bac84822a371ec397fce63

4c075bc85801af9ec5bac84822a371ec397fce63
diff --git a/aggressive-murja.asd b/aggressive-murja.asd
index ae4d3e2..ce79198 100644
--- a/aggressive-murja.asd
+++ b/aggressive-murja.asd
@@ -29,7 +29,8 @@
 	       "alexandria"
 	       "uuid"
 	       "cl-hash-util"
-	       "spinneret")
+	       "spinneret"
+	       "parenscript")
   :description "A rewrite of the <a href=\"https://github.com/feuery/murja-blog/\">murja blogging engine</a> in lisp"
   :components ((:module "src"
 		:components
@@ -83,7 +84,8 @@
 				 (:file "blogpost")))
 		   (:module "admin"
 		    :components ((:module "components"
-				  :components ((:file "editor")))
+				  :components ((:file "tag-script")
+					       (:file "editor")))
 				 (:file "post-list")
 				 (:file "new-post")))
 		   (:file "blog-root")
diff --git a/resources/css/murja.css b/resources/css/murja.css
index c865f6a..f2b30ae 100644
--- a/resources/css/murja.css
+++ b/resources/css/murja.css
@@ -451,6 +451,15 @@ input:required {
     display: inline;
 }
 
+.tag-component {
+    display: flex;
+    flex-direction: column;
+}
+
+.tag-component > * {
+    margin: 3px;
+}
+
 @media only screen and (max-device-width:480px)
 {
     body {
diff --git a/src/view/admin/components/editor.lisp b/src/view/admin/components/editor.lisp
index 042dc7f..9049f2a 100644
--- a/src/view/admin/components/editor.lisp
+++ b/src/view/admin/components/editor.lisp
@@ -1,18 +1,38 @@
 (defpackage murja.view.admin.components.editor
-  (:use :cl :binding-arrows :spinneret)
+  (:use :cl :binding-arrows :spinneret )
   (:export :editor)
-  (:import-from :murja.model.post :article :post-title :post-hidden? :post-unlisted?))
+  (:import-from :murja.view.admin.components.tag-script :tags-component-frontend)
+  (:import-from :murja.model.post :tags :article :post-title :post-hidden? :post-unlisted?))
 
 (in-package :murja.view.admin.components.editor)
 
+(defun tag-component (post)
+  (with-html
+    (:div.tag-component
+     (:select :multiple t :class "tag-select" :id "tag-select"
+       (dolist (tag (tags post))
+	 (:option :value tag tag)))
+     (:button :id "add-tag" "Add tag")
+     (:button :id "remove-tag" "Remove tag")
+
+     (:script
+      (:raw (tags-component-frontend))))))
+
+(defun post-meta (post)
+  (with-html
+    (:div 
+     (:label "Title: "
+	     (:input :id "title" :name "title" :value (post-title post) :type "text"))
+     (:label "Hidden: "
+	     (:input :id "hidden" :name "hidden" :checked (post-hidden? post) :type "checkbox"))
+     (:label "Unlisted: "
+	     (:input :id "unlisted" :name "unlisted" :checked (post-unlisted? post) :type "checkbox")))))
+
 (defun header (post)
   (with-html
-    (:label "Title: "
-	    (:input :id "title" :name "title" :value (post-title post) :type "text"))
-    (:label "Hidden: "
-	    (:input :id "hidden" :name "hidden" :checked (post-hidden? post) :type "checkbox"))
-    (:label "Unlisted: "
-	    (:input :id "unlisted" :name "unlisted" :checked (post-unlisted? post) :type "checkbox"))))
+    (:div.editor-top 
+     (post-meta post)
+     (tag-component post))))
 
 (defun editor (post)
   (with-html
diff --git a/src/view/admin/components/tag-script.lisp b/src/view/admin/components/tag-script.lisp
new file mode 100644
index 0000000..a85c303
--- /dev/null
+++ b/src/view/admin/components/tag-script.lisp
@@ -0,0 +1,37 @@
+(defpackage murja.view.admin.components.tag-script
+  (:use :cl :binding-arrows :parenscript)
+  (:export :tags-component-frontend)
+  (:documentation "All the parenscript logic hidden from making murja.view.admin.components.editor an eyesore"))
+
+(in-package :murja.view.admin.components.tag-script)
+
+(defun tags-component-frontend ()
+  (ps
+    (chain document
+	   (add-event-listener "DOMContentLoaded"
+			       (lambda (e)
+				 (let ((add-tag (chain document
+						       (query-selector "#add-tag")))
+				       (remove-tag (chain document
+							  (query-selector "#remove-tag")))
+				       (tag-select (chain document
+							  (query-selector "#tag-select"))))
+
+				   (chain add-tag
+					  (add-event-listener "click" (lambda (e)
+									(let* ((new-tag (chain
+											(prompt "New tag?")
+											(to-lower-case)))
+									       (as-option (chain
+											   document
+											   (create-element "option"))))
+									  (setf (@ as-option text) new-tag)
+									  (chain tag-select
+										 options
+										 (add as-option))))))
+									  
+				   (chain remove-tag
+					  (add-event-listener "click" (lambda (e)
+									(chain
+									 tag-select
+									 (remove (@ tag-select selected-index))))))))))))