diff of a24b07783d4379c87ab3c7a7697422115ef17f0c

a24b07783d4379c87ab3c7a7697422115ef17f0c
diff --git a/aggressive-murja.asd b/aggressive-murja.asd
index 56375c8..cdbdb8b 100644
--- a/aggressive-murja.asd
+++ b/aggressive-murja.asd
@@ -89,7 +89,8 @@
 				 (:file "root")
 				 (:file "post")
 				 (:file "page")))
-		   (:file "blog-main")))
+		   (:file "blog-main")
+		   (:file "blog-post")))
 		 
 		 (:file "main"))))
   :in-order-to ((test-op (test-op "aggressive-murja/tests"))))
diff --git a/resources/css/murja.css b/resources/css/murja.css
index 77b22cf..9508fa2 100644
--- a/resources/css/murja.css
+++ b/resources/css/murja.css
@@ -434,6 +434,12 @@ input:required {
 .initial-form > label > input {
 }
 
+.linear-post-footer-nav {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+}
+
 @media only screen and (max-device-width:480px)
 {
     body {
diff --git a/src/models/post.lisp b/src/models/post.lisp
index e6b2507..32a583e 100644
--- a/src/models/post.lisp
+++ b/src/models/post.lisp
@@ -17,8 +17,8 @@
    (created-at :initarg :created-at :accessor created-at :col-type simple-date:timestamp)
    (hidden :initarg :hidden? :accessor post-hidden? :col-type boolean)
    (unlisted :initarg :unlisted? :accessor post-unlisted? :col-type boolean)
-   (previous :ghost t :initarg :previous :accessor previous-post-id :col-type integer)
-   (next :ghost t :initarg :next :accessor next-post-id :col-type integer))
+   (previous :ghost t :initarg :previous :accessor previous-post-id :col-type integer :initform -1)
+   (next :initform -1 :ghost t :initarg :next :accessor next-post-id :col-type integer))
   (:metaclass postmodern:dao-class)
   (:keys id)
   (:table-name "blog.Post"))
diff --git a/src/murja-newui/newui.lisp b/src/murja-newui/newui.lisp
index 9280cb7..d539e7e 100644
--- a/src/murja-newui/newui.lisp
+++ b/src/murja-newui/newui.lisp
@@ -101,7 +101,9 @@
   s)
 
 (defmethod render ((s t))
-  (prin1-to-string s))
+  (if s 
+      (prin1-to-string s)
+      ""))
 
 (defparameter *single-element-tags* (list :link :meta :input :img)
   "Contains tags that don't expand to <:tag attrs>children</:tag> but instead into <:tag attrs />")
diff --git a/src/routes/root-routes.lisp b/src/routes/root-routes.lisp
index 4976754..9ce164f 100644
--- a/src/routes/root-routes.lisp
+++ b/src/routes/root-routes.lisp
@@ -116,8 +116,8 @@
   *root*)
 
 
-(defroute post-view ("/blog/post/:id" :method :get) ()
-  *root*)
+;; (defroute post-view ("/blog/post/:id" :method :get) ()
+;;   *root*)
 
 (defroute edit ("/blog/post/edit/:id" :method :get) ()
   *root*)
diff --git a/src/views/blog-post.lisp b/src/views/blog-post.lisp
new file mode 100644
index 0000000..45b0cc2
--- /dev/null
+++ b/src/views/blog-post.lisp
@@ -0,0 +1,22 @@
+(defpackage murja.views.blog-post
+  (:use :cl :murja.views.components.root :murja.views.components.tab :murja.models.post)
+  (: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.newui :@newui :c :with-state)
+  (:import-from :easy-routes :defroute))
+
+(in-package :murja.views.blog-post)
+
+(defroute blog-root-view ("/blog/post/:id" :method :get
+					   :decorators (@newui @transaction)) ()
+  
+  (let* ((current-post (get-post id)))
+    (root-component
+     (tabs "Home"
+	   (hash
+	    ("Home"
+	     (if current-post 
+		 (murja.views.components.post:post current-post :show-footer? t)
+		 (c :div () "not found"))))))))
diff --git a/src/views/components/post.lisp b/src/views/components/post.lisp
index 68a6659..bab0a21 100644
--- a/src/views/components/post.lisp
+++ b/src/views/components/post.lisp
@@ -1,11 +1,11 @@
 (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)
+  (: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)
+(defun post (post &key show-footer?)
   (let ((creator (creator post)))
     (c :article (:class "post")
        (c :h2 ()
@@ -18,5 +18,16 @@
 	     (c :time (:datetime (created-at post))
 		(created-at post))))
 
-       (c :section (:class "content") (article 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")))))))