| 1 | (in-package :lisp-on-lines) |
| 2 | |
| 3 | (export '(html-description)) |
| 4 | |
| 5 | (define-description html-description () |
| 6 | ((css-class :value "lol-description") |
| 7 | (dom-id :function (lambda (x) |
| 8 | (declare (ignore x)) |
| 9 | (symbol-name |
| 10 | (gensym "DOM-ID-"))))) |
| 11 | (:mixinp t)) |
| 12 | |
| 13 | |
| 14 | (define-description t (html-description) |
| 15 | () |
| 16 | (:in-description html-description)) |
| 17 | |
| 18 | (define-layered-class html-attribute () |
| 19 | ((css-class :accessor attribute-css-class |
| 20 | :initform "lol-attribute") |
| 21 | (dom-id :accessor attribute-dom-id :initform nil))) |
| 22 | |
| 23 | (define-layered-class standard-attribute |
| 24 | :in-layer #.(defining-description 'html-description) |
| 25 | (html-attribute) |
| 26 | ()) |
| 27 | |
| 28 | (define-display |
| 29 | :in-description html-description ((description t)) |
| 30 | (with-attributes (css-class dom-id) description |
| 31 | |
| 32 | (<:div |
| 33 | :class (attribute-value* css-class) |
| 34 | :id (attribute-value* dom-id) |
| 35 | (dolist (attribute (attributes description)) |
| 36 | (<:div |
| 37 | :class (attribute-css-class attribute) |
| 38 | (when (attribute-dom-id attribute) |
| 39 | :id (attribute-dom-id attribute)) |
| 40 | (<:span |
| 41 | :class "lol-attribute-label" |
| 42 | (<:as-html (attribute-label attribute))) |
| 43 | (<:span |
| 44 | :class "lol-attribute-value" |
| 45 | (<:as-html (attribute-value* attribute)))))))) |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |