(in-package :lisp-on-lines)
-(defaction read-instance ((self component) instance)
+(defmethod/cc read-instance ((self component) instance)
"View an existing instance"
(call 'crud-viewer :instance instance))
-(defaction update-instance ((self component) instance)
+(defmethod/cc update-instance ((self component) instance)
"Edit an instance, possibly a newly created one"
(call 'crud-editor :instance instance))
-(defaction create-instance ((self component) class &rest initargs)
+(defmethod/cc create-instance ((self component) class &rest initargs)
"Create a new instance and edit it."
(update-instance self (apply #'make-instance class initargs)))
(display (make-instance 'component) instance
:layers '(+ as-string)))))
-(defaction delete-instance ((self component) instance)
- (when (call 'option-dialog
- :message (format nil "Really Delete ~A" (display-as-string instance))
- :options '((t "Yes, really delete it,")
- (nil "No, i'll hold on to this one.")))
- (let ((delete-failed (%delete-instance-and-return-nil instance)))
- (if (not delete-failed)
- (answer t)
- (progn
- (call 'info-message :message delete-failed)
- (answer t))))))
+(defmethod/cc delete-instance ((self component) instance)
+ (when (call 'option-dialog
+ :message (format nil "Really Delete ~A" (display-as-string instance))
+ :options '((t "Yes, really delete it,")
+ (nil "No, i'll hold on to this one.")))
+ (let ((delete-failed (%delete-instance-and-return-nil instance)))
+ (if (not delete-failed)
+ (answer t)
+ (progn
+ (call 'info-message :message delete-failed)
+ (answer t))))))
(defmethod breadcrumb-name (component)
(defun render-breadcrumb (self)
(<:p :class "breadcrumb"
- (let ((count 0)
- (trail-length 3))
- (labels ((find-call-stack-for-crumbs (component list-of-parents)
- (cond ((and (not (null component))
- (> trail-length count))
- (incf count)
- (find-call-stack-for-crumbs
- (when (slot-boundp component 'ucw::calling-component)
- (slot-value component 'ucw::calling-component))
- (cons component list-of-parents)))
- (t
- list-of-parents))))
- (loop
- :for c
- :on (find-call-stack-for-crumbs self nil)
- :do (let ((c c))
- (<:as-html " / ")
- (if (cdr c)
- (<ucw:a
- :action (answer-component (second c) nil)
- (<:as-html (breadcrumb-name (first c))))
- (<:as-html (breadcrumb-name (first c))))))))))
+ (let ((count 0)
+ (trail-length 3))
+ (labels ((find-call-stack-for-crumbs (component list-of-parents)
+ (cond ((and (not (null component))
+ (> trail-length count))
+ (incf count)
+ (find-call-stack-for-crumbs
+ (when (slot-boundp component 'ucw::calling-component)
+ (slot-value component 'ucw::calling-component))
+ (cons component list-of-parents)))
+ (t
+ list-of-parents))))
+ (loop
+ :for c
+ :on (find-call-stack-for-crumbs self nil)
+ :do (let ((c c))
+ (<:as-html " / ")
+ (if (cdr c)
+ (<ucw:a
+ :action (answer-component (second c) nil)
+ (<:as-html (breadcrumb-name (first c))))
+ (<:as-html (breadcrumb-name (first c))))))))))
(defcomponent crud ()
((instance :accessor instance :initarg :instance :initform nil))
"Around every attribute of a CRUD instance, i'd like to wrap a div."
(<:div
:class (format nil "crud-~A" (string-downcase
- (string (attribute.name attribute))))
+ (string (attribute-name attribute))))
(call-next-method)))
;;;; A description contains attributes.
(defcomponent crud-editor (crud validation-mixin)
())
-(defaction ensure-instance ((self crud-editor))
+(defmethod/cc ensure-instance ((self crud-editor))
"This one does a little magic, see SYNC-INSTANCE"
(meta-model::sync-instance (instance self)))
:action (create-instance object (db-class object))
(<:as-html "(Create New " (db-class object) ")"))))
-(defaction call-crud-summary ((self component) class)
+(defmethod/cc call-crud-summary ((self component) class)
(call 'crud-summary :class class))