Move span to use :content

This commit is contained in:
David Botton 2021-01-15 17:06:50 -05:00
parent 019fb2b68c
commit cc9cf14b17
4 changed files with 8 additions and 7 deletions

View file

@ -448,12 +448,12 @@ CLOG-OBJ"))
;; create-span ;; ;; create-span ;;
;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;
(defgeneric create-span (clog-obj content &key auto-place) (defgeneric create-span (clog-obj &key content auto-place)
(:documentation "Create a new CLOG-Span as child of CLOG-OBJ with CONTENT (:documentation "Create a new CLOG-Span as child of CLOG-OBJ with CONTENT
and if :AUTO-PLACE (default t) place-inside-bottom-of and if :AUTO-PLACE (default t) place-inside-bottom-of
CLOG-OBJ")) CLOG-OBJ"))
(defmethod create-span ((obj clog-obj) content &key (auto-place t)) (defmethod create-span ((obj clog-obj) &key (content "") (auto-place t))
(create-child obj (format nil "<span>~A</span>" (escape-string content)) (create-child obj (format nil "<span>~A</span>" (escape-string content))
:clog-type 'clog-span :auto-place auto-place)) :clog-type 'clog-span :auto-place auto-place))

View file

@ -295,14 +295,14 @@ not relevant not just visually and will _also_ remove it from layout similar to
setting display (None).")) setting display (None)."))
(defmethod hiddenp ((obj clog-element)) (defmethod hiddenp ((obj clog-element))
(js-true-p (property obj "hidden"))) (js-true-p (attribute obj "hidden")))
(defgeneric set-hiddenp (clog-element value) (defgeneric set-hiddenp (clog-element value)
(:documentation "Set hiddenp VALUE for CLOG-ELEMENT")) (:documentation "Set hiddenp VALUE for CLOG-ELEMENT"))
(defmethod set-hiddenp ((obj clog-element) value) (defmethod set-hiddenp ((obj clog-element) value)
(if value (if value
(setf (property obj "hidden") t) (setf (attribute obj "hidden") t)
(remove-attribute obj "hidden"))) (remove-attribute obj "hidden")))
(defsetf hiddenp set-hiddenp) (defsetf hiddenp set-hiddenp)

View file

@ -31,7 +31,7 @@
(port 8080) (port 8080)
(boot-file "/boot.html") (boot-file "/boot.html")
(static-root #P"./static-files/")) (static-root #P"./static-files/"))
"Inititalze CLOG on a socket using HOST and PORT to serve BOOT-FILE as "Inititalize CLOG on a socket using HOST and PORT to serve BOOT-FILE as
the default route to establish web-socket connections and static files the default route to establish web-socket connections and static files
located at STATIC-ROOT. If CLOG was already initialized and not shut located at STATIC-ROOT. If CLOG was already initialized and not shut
down, this function does the same as set-on-new-window." down, this function does the same as set-on-new-window."

View file

@ -84,7 +84,8 @@
(setf (title (html-document body)) (value fe1)) (setf (title (html-document body)) (value fe1))
(setf (background-color p1) (value fe2)) (setf (background-color p1) (value fe2))
(setf (hiddenp f1) t) (setf (hiddenp f1) t)
(create-span p1 "<br><b>Your form has been submitted</b>"))) (create-span p1 :content
"<br><b>Your form has been submitted</b>")))
(setf (width p1) "100%") (setf (width p1) "100%")
(setf (width p2) "100%") (setf (width p2) "100%")
@ -126,7 +127,7 @@
(set-on-submit f2 (set-on-submit f2
(lambda (obj) (lambda (obj)
(setf (hiddenp f2) t) (setf (hiddenp f2) t)
(create-span p2 (create-span p2 :content
(format nil "<br><b>Your form has been submitted:</b> (format nil "<br><b>Your form has been submitted:</b>
<br>~A<hr>1 - ~A<br>2 - ~A<br>3 - ~A" <br>~A<hr>1 - ~A<br>2 - ~A<br>3 - ~A"
(value ta1) (value ta1)