simplified slot access somewhat. layered slots still a little screwy.
[clinton/lisp-on-lines.git] / src / ucw / html-description.lisp
CommitLineData
4358148e 1(in-package :lisp-on-lines)
2
81d70610 3(export '(html-description) (find-package :lisp-on-lines))
4358148e 4
5(define-description html-description ()
81d70610 6 ())
7
8
9(define-description t ()
4358148e 10 ((css-class :value "lol-description")
11 (dom-id :function (lambda (x)
12 (declare (ignore x))
13 (symbol-name
14 (gensym "DOM-ID-")))))
4358148e 15 (:in-description html-description))
16
17(define-layered-class html-attribute ()
18 ((css-class :accessor attribute-css-class
19 :initform "lol-attribute")
20 (dom-id :accessor attribute-dom-id :initform nil)))
21
22(define-layered-class standard-attribute
23 :in-layer #.(defining-description 'html-description)
24 (html-attribute)
25 ())
26
27(define-display
28 :in-description html-description ((description t))
29 (with-attributes (css-class dom-id) description
81d70610 30 (<:style
31 (<:as-html "
32
33.lol-attribute-label, .lol-attribute-value {
34 display: block;
35 width: 70%;
36 float: left;
37 margin-bottom: 10px;
38
39}
40.lol-attribute-label {
41 text-align: right;
42 width: 24%;
43 padding-right: 20px;
44}
45
46.lol-attribute-value {
47
48 }
49
50br {
51clear: left;
52}"))
53
4358148e 54 (<:div
81d70610 55 :class (list (attribute-value* css-class) "lol-description")
4358148e 56 :id (attribute-value* dom-id)
57 (dolist (attribute (attributes description))
58 (<:div
59 :class (attribute-css-class attribute)
60 (when (attribute-dom-id attribute)
61 :id (attribute-dom-id attribute))
81d70610 62 (let ((label (attribute-label attribute)))
63 (when label
64 (<:label
65 :class "lol-attribute-label"
66 (<:as-html label))))
4358148e 67 (<:span
68 :class "lol-attribute-value"
81d70610 69 (<:as-html (format nil "~A" (attribute-value* attribute))))
70 (<:br))))))
4358148e 71
72
73
74
75