X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/80fcd57c2870eac29dc3e21849d358b6b58adcf8..6de8d30004efc9337b8c40d2ff2d0a76651d23eb:/src/ucw/html-description.lisp diff --git a/src/ucw/html-description.lisp b/src/ucw/html-description.lisp index a77c24a..57c8125 100644 --- a/src/ucw/html-description.lisp +++ b/src/ucw/html-description.lisp @@ -7,11 +7,12 @@ (define-description t () - ((css-class :value "lol-description") + ((css-class :value "lol-description" :activep nil) (dom-id :function (lambda (x) (declare (ignore x)) (symbol-name - (gensym "DOM-ID-"))))) + (gensym "DOM-ID-"))) + :activep nil)) (:in-description html-description)) (define-layered-class html-attribute () @@ -24,50 +25,110 @@ (html-attribute) ()) -(define-display - :in-description html-description ((description t)) - (with-attributes (css-class dom-id) description - (<:style - (<:as-html " +(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)) + (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" + (if (attribute-editp object attribute) + (