app-data objects and clog-body #165
-
In Demo 4 there's a class created to hold data that gets passed around between functions: (defclass app-data ()
((head
:accessor head)
(side
:accessor side)
(main
:accessor main)
(sysop
:initform nil
:accessor sysop))) However let's suppose I want to persist a login session so that I can close the browser and come back without having to log in again. But if I want to follow a Demo 4-style architecture where I use an app-data object to pass around the contents of menus and headers and stuff, must I also pass around For example I could do something like this: (defun login-form (app)
(create-label (main app) :content "Username:")
(create-br (main app))
(let ((uname (create-form-element (main app) :text)))
(create-br (main app))
(create-label (main app) :content "Password:")
(create-br (main app))
(let ((pwd (create-form-element (main app) :text)))
(create-br (main app))
(set-on-click (create-button (main app) :content "Submit")
(lambda (obj)
(declare (ignore obj))
(if (auth-user (escape-string (value uname)) (escape-string (value pwd)))
(progn
(setf (role app) :user)
(route-content app "Home"))
(clog-web:clog-web-alert (main app) "Get rekt" "Bad username and/or password." :time-out 3 :place-top t))))
(set-on-click (create-button (main app) :content "Cancel")
(lambda (obj)
(declare (ignore obj))
(route-content app "Home")))))) But I can't access Is there a way to access |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It looks like the |
Beta Was this translation helpful? Give feedback.
-
Thanks @herbertjones for the hint. For any newbs working with the pull down menuing templates that want to open up a popup and populate it with something that can draw to the main background window, you can just use something like (create-div (connection-body obj) :content "TEST" :class "w3-red") to access the body object. Neat! |
Beta Was this translation helpful? Give feedback.
It looks like the
clog-body
object is available by usingconnection-body
on anyclog-obj
.