From 58afc03ae572eb56cb5a3b7b685689433edc13c7 Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 7 Mar 2023 19:29:39 -0800 Subject: Add: path to adventure pages; stuff to asd file; some endpoints --- dnd.asd | 23 ++++++++++++++++++----- src/endpoints.lisp | 6 ++++++ src/pages/tavern.lisp | 10 ++++++++++ src/views/adventure.lisp | 4 +++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/dnd.asd b/dnd.asd index aad542e..adabbfb 100644 --- a/dnd.asd +++ b/dnd.asd @@ -34,18 +34,31 @@ (:file "render") (:module "views" :serial t - :components ((:file "components") + :components ( + + (:file "adventure") + (:file "components") + (:file "hazard") (:file "hero") (:file "player") (:file "quest") - (:file "hazard") - (:file "adventure"))) + (:file "rumor") + )) (:module "pages" :serial t - :components ((:file "doorkeeper") + :components ( + + (:file "adventure-awaits") + (:file "adventure-page") + (:file "doorkeeper") (:file "goddess-shrine") + (:file "hero-page") (:file "join") - (:file "tavern"))) + (:file "quest-page") + (:file "spymaster") + (:file "tavern")) + + ) (:file "endpoints") (:file "init") (:file "dnd"))))) diff --git a/src/endpoints.lisp b/src/endpoints.lisp index 51d2de3..096603a 100644 --- a/src/endpoints.lisp +++ b/src/endpoints.lisp @@ -138,6 +138,12 @@ functions in url parameters in endpoint definitions." (render (page-render-mode) (make-instance 'tavern :player me)))) +(defendpoint* :get "/tavern/adventures" () () + (with-session (me) + (render (page-render-mode) + (make-instance 'tavern-adventures + :your-adventures (adventures-visible-by me))))) + (defendpoint* :get "/goddess-shrine" () () (with-session (player) (render (page-render-mode) :goddess-shrine))) diff --git a/src/pages/tavern.lisp b/src/pages/tavern.lisp index 0ec3cd5..591d424 100644 --- a/src/pages/tavern.lisp +++ b/src/pages/tavern.lisp @@ -12,6 +12,7 @@ (when (player-heroes player) (:h2 "Your Heroes'") (render :list (player-heroes player))) + (:a :href "tavern/adventures" "Adventures for which you are seer.") (:br) (:a :href "/goddess-shrine" "Pray a new hero rises.") (:br) @@ -19,3 +20,12 @@ (:br) (:a :href "/adventure-awaits" "Embark on a new Adventure!")))) + +(defclass/std tavern-adventures () + ((your-adventures))) + + +(defrender t ((page tavern-adventures)) + (with-page (:title "Your Adventures") + (:h1 "You are seer on teh following adventures") + (render :list (your-adventures page)))) diff --git a/src/views/adventure.lisp b/src/views/adventure.lisp index 8d4cebc..85d8e3d 100644 --- a/src/views/adventure.lisp +++ b/src/views/adventure.lisp @@ -2,7 +2,6 @@ (in-package :dnd) - (defrender :inline ((adventure adventure)) (with-html (:a :href (urlpath adventure) (title adventure)))) @@ -10,3 +9,6 @@ (defrender :option ((adventure adventure)) (with-html (:option :value (uid adventure) (title adventure)))) + +(defrender :list-item ((adventure adventure)) + (render :inline adventure)) -- cgit v1.2.3