From bba7cf449944c1c0eb85c530a721e23c392a03c6 Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Sat, 24 Sep 2022 21:04:49 +0100 Subject: [PATCH] implement the /view/archive/:slug route and add archive-entry.html. --- src/web.lisp | 23 +++++++++++------------ templates/archive-entry.html | 7 +++++++ 2 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 templates/archive-entry.html diff --git a/src/web.lisp b/src/web.lisp index 6aaa4ca..f02e196 100644 --- a/src/web.lisp +++ b/src/web.lisp @@ -925,18 +925,17 @@ :archive-entries ,(nera:get-all-archive-entries)))))) (defroute ("/view/archive/:slug" :method :GET) (&key slug) - (format nil "Page not implemented")) - ;; (let ((alert (utils:get-and-reset-alert))) - ;; (if (storage:file-exists-p "" "pages" slug) - ;; (render #P"archive.html" - ;; (append (if (hermetic:logged-in-p) - ;; (auth:auth-user-data)) - ;; `(:alert ,alert - ;; :db-data ,(nera:get-page slug) - ;; :system-data ,(nera:system-data) - ;; :data ,(storage:open-text-file - ;; "" "pages" slug)))) -;; (on-exception *web* 404)))) + (let ((alert (utils:get-and-reset-alert))) + (if (storage:file-exists-p "" "archive" slug) + (render #P"archive-entry.html" + (append (if (hermetic:logged-in-p) + (auth:auth-user-data)) + `(:alert ,alert + :db-data ,(nera:get-archive-entry :slug slug) + :system-data ,(nera:system-data) + :data ,(storage:open-text-file + "" "archive" slug)))) + (on-exception *web* 404)))) (defroute ("/user/archive" :method :GET) () (hermetic:auth (:logged-in) diff --git a/templates/archive-entry.html b/templates/archive-entry.html new file mode 100644 index 0000000..dccdf1c --- /dev/null +++ b/templates/archive-entry.html @@ -0,0 +1,7 @@ +{% extends "layouts/default.html" %} +{% block title %}{{db-data.title}}{% endblock %} +{% block content %} +
+ {{data | safe}} +
+{% endblock %}