X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/4358148e6c67fcc2ae24050c54d8050b4dc03f9d..e8d4fa4537a1655714ad8bbbf9b7ba2d85ead959:/src/ucw/html-description.lisp diff --git a/src/ucw/html-description.lisp b/src/ucw/html-description.lisp index 8dae20a..120d317 100644 --- a/src/ucw/html-description.lisp +++ b/src/ucw/html-description.lisp @@ -1,18 +1,17 @@ (in-package :lisp-on-lines) -(export '(html-description)) +(export '(html-description) (find-package :lisp-on-lines)) (define-description html-description () - ((css-class :value "lol-description") + ()) + +(define-description t () + ((css-class :value "lol-description" :activep nil) (dom-id :function (lambda (x) (declare (ignore x)) (symbol-name - (gensym "DOM-ID-"))))) - (:mixinp t)) - - -(define-description t (html-description) - () + (gensym "DOM-ID-"))) + :activep nil)) (:in-description html-description)) (define-layered-class html-attribute () @@ -25,24 +24,113 @@ (html-attribute) ()) -(define-display - :in-description html-description ((description t)) - (with-attributes (css-class dom-id) description - - (<:div - :class (attribute-value* css-class) - :id (attribute-value* dom-id) - (dolist (attribute (attributes description)) - (<:div +(define-layered-function display-html-attribute-label (object attribute) + (:method (object attribute) + (let ((label (attribute-label attribute))) + (<:label + :class "lol-attribute-label" + (when label + (<:as-html + (with-output-to-string (*display*) + (display-attribute-label object attribute)))))))) + +(define-layered-function display-html-attribute-value (object attribute) + (:method (object attribute) + (<:span + :class "lol-attribute-value" + (<:as-html + (with-output-to-string (*display*) + (display-attribute-value object attribute)))) +)) + +(define-layered-function display-html-attribute (object attribute) + (:method (object attribute) + (<:div :class (attribute-css-class attribute) (when (attribute-dom-id attribute) :id (attribute-dom-id attribute)) - (<:span - :class "lol-attribute-label" - (<:as-html (attribute-label attribute))) - (<:span + (display-html-attribute-label object attribute) + (display-html-attribute-value object attribute) + (<:br))) + (:method :in-layer #.(defining-description 'inline) + (object attribute) + (<:span + :class (attribute-css-class attribute) + (when (attribute-dom-id attribute) + :id (attribute-dom-id attribute)) + (display-html-attribute-label object attribute) + (<:as-html " ") + (display-html-attribute-value object attribute) + (<:as-html " ")))) + +(define-layered-method display-html-attribute-value + :in-layer #.(defining-description 'editable) (object attribute) + + (<:span :class "lol-attribute-value" - (<:as-html (attribute-value* attribute)))))))) + (if (attribute-editp object attribute) + (