HCoop
/
clinton
/
lisp-on-lines.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Drop usage of defaction
[clinton/lisp-on-lines.git]
/
src
/
attributes
/
numbers.lisp
diff --git
a/src/attributes/numbers.lisp
b/src/attributes/numbers.lisp
index
6fb0460
..
45d8aaa
100644
(file)
--- a/
src/attributes/numbers.lisp
+++ b/
src/attributes/numbers.lisp
@@
-9,6
+9,14
@@
()
(:type-name integer))
()
(:type-name integer))
+(defattribute integer-attribute (number-attribute integer-field)
+ ()
+ (:in-layer editor)
+ (:default-initargs
+ :default-value ""
+ :default-value-predicate (complement #'numberp))
+ (:type-name integer))
+
(define-layered-method (setf attribute-value) ((value string) object (attribute integer-attribute))
(let ((*read-eval* nil))
(define-layered-method (setf attribute-value) ((value string) object (attribute integer-attribute))
(let ((*read-eval* nil))
@@
-36,16
+44,21
@@
()
(:type-name currency))
()
(:type-name currency))
+
(defdisplay
(defdisplay
+ :in-layer t
((currency currency-attribute) object)
((currency currency-attribute) object)
- (<:as-html "$")
- (call-next-method))
-(defdisplay :in-layer editor
- ((currency currency-attribute) object)
- (<:as-html "$")
+ (<:as-html (format nil "$~$" (or (attribute-value object currency) ""))))
+
+(defdisplay
+ :in-layer editor
+ ((currency currency-attribute) object)
+ (LET ((value (attribute-value (object currency) currency)))
(<:input
(<:input
- :type "text"
- :id (id currency)
- :name (callback currency)
- :value (format nil "~$" (or (attribute-value object currency) ""))))
+ :NAME
+ (callback currency)
+ :VALUE (escape-as-html (strcat (display-value currency value)))
+ :TYPE
+ "text"))
+ )