summaryrefslogtreecommitdiff
path: root/pages.lisp
diff options
context:
space:
mode:
authorGrant Shoshin Shangreaux <shoshin@cicadas.surf>2023-03-05 11:33:08 -0600
committerGrant Shoshin Shangreaux <shoshin@cicadas.surf>2023-03-05 11:33:08 -0600
commit89d0d687992b41f7f0f9b0d3da19d9d587f06010 (patch)
tree8d1dabc9cf9c79358b16c23959681fc299219e57 /pages.lisp
parent04df19a88a381e6bdc60d7f566e02e99b40c0087 (diff)
Add: page-render-mode, model cleanup, tavern view wip
Diffstat (limited to 'pages.lisp')
-rw-r--r--pages.lisp40
1 files changed, 30 insertions, 10 deletions
diff --git a/pages.lisp b/pages.lisp
index 9701334..378156a 100644
--- a/pages.lisp
+++ b/pages.lisp
@@ -32,6 +32,14 @@ must specialize :left :milsddle :right on your desired data type."
(:div :class "middle-column" (render :middle data))
(:div :class "right-column" (render :right data)))))
+;;; Object-Endpoint Helpers
+
+(defgeneric url-path-to (obj)
+ (:documentation "Return a string that is the absolute url path to OBJ."))
+
+(defmethod url-path-to ((obj campaign))
+ (format nil "/campaign/~a" (urlify (title obj))))
+
;;; PAGES
(defmacro with-page ((&key title) &body body)
@@ -95,19 +103,31 @@ must specialize :left :milsddle :right on your desired data type."
(with-page (:title "A Bustling Tavern")
(render :three-column-layout tavern)))
-(defun tavern-text (player)
- (with-page (:title "A Bustling Tavern")
- (render :page-text (make-instance 'tavern :player player))))
-
-(defrender :page-text ((tavern tavern))
+(defrender :text-page ((tavern tavern))
(let ((player (player tavern)))
(with-html
(render :details player)
- (:table
- (:tr (:td (:h4 "Your Heroes"))
- (:td (:h4 "Your Campaigns")))
- (:tr (:td (:h4 "Gossip & Gab"))
- (:td (:h4 "Comrades in Arms")))))))
+ (render :list (player-heroes player))
+ (:a :href "/spymaster" "Report a Roguish Rumour...")
+ ;; (:table
+ ;; (:tr (:td (:h4 "Your Heroes"))
+ ;; (:td (:h4 "Your Campaigns")))
+ ;; (:tr (:td (:h4 "Gossip & Gab"))
+ ;; (:td (:h4 "Comrades in Arms"))))
+
+ )))
+
+(defrender :list-item ((hero hero))
+ (with-html
+ (with-slots ((name campaign) hero)
+ (:p name "the" (hero-class hero) (hero-title hero)
+ (when campaign
+ (:span "who is off in the campaign")
+ (:span (render :inline campaign)))))))
+
+(defrender :inline ((campaign campaign))
+ (with-html
+ (:a :href (url-path-to campaign) (title campaign))))
(defrender :left ((tavern tavern))
(let ((player (player tavern)))