Browse Source

add older/newer archive entries to data returned from /view/archive.

stable
Craig Oates 2 years ago
parent
commit
2b4336bced
  1. 21
      src/web.lisp

21
src/web.lisp

@ -1006,14 +1006,19 @@
(defroute ("/view/archive/:slug" :method :GET) (&key slug)
(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))))
(let* ((archive-entry (nera:get-archive-entry :slug slug))
(archive-id (archive::object-id archive-entry)))
(render #P"archive-entry.html"
(append (if (hermetic:logged-in-p)
(auth:auth-user-data))
`(:alert ,alert
:db-data ,archive-entry
:system-data ,(nera:system-data)
:newer-entries
,(nera:get-newer-archive-entries archive-id 2)
:older-entries
,(nera:get-older-archive-entries archive-id 2)
:data ,(storage:open-text-file "" "archive" slug)))))
(on-exception *web* 404))))
(defroute ("/user/archive" :method :GET) ()

Loading…
Cancel
Save