fixed the macros a little
[clinton/lisp-on-lines.git] / src / lisp-on-lines.lisp
index 77dab5c..ca00bc5 100644 (file)
@@ -42,16 +42,20 @@ This involves creating a meta-model, a clsql view-class, and the setting up the
                `(:initargs
                  '(,@ (mapcan #'identity args)))))))
 
-(defmethod make-view (object &rest args &key (type :viewer) (attributes nil)
+(defmethod make-view (object &rest args &key (type :viewer)
                      &allow-other-keys )
-  (apply #'make-presentation (cdr (%make-view object type attributes args))))
+  (remf args :type)
+  ;(warn "~A ~A" args `(:type ,type :initargs ,@args))
+  (apply #'make-presentation object `(:type ,type ,@ (when args
+                                                      `(:initargs ,args)))))
 
 (defmacro present-view ((object &optional (type :viewer) (parent 'self))
                        &body attributes-and-args)
   (arnesi:with-unique-names (view)
     `(let ((,view (lol:make-view ,object
                                 :type ,type
-                                :attributes ,(car attributes-and-args)
+                                ,@(when (car attributes-and-args)
+                                        `(:attributes ',(car attributes-and-args))) 
                                 ,@ (cdr attributes-and-args))))
       (setf (ucw::parent ,view) ,parent)
       (lol:present ,view))))
@@ -83,14 +87,8 @@ This involves creating a meta-model, a clsql view-class, and the setting up the
 
 
 
-(defun %delete-item (item)
-  (ignore-errors
-    (clsql:delete-instance-records item)))
 
-(defaction delete-item ((self component) instance)
-  (if (%delete-item instance)
-      (answer nil)
-      (call 'info-message :message "Could not remove item. Try removing associated items first.")))
+
 
 (defmethod word-search (class-name slots search-terms 
                        &key (limit 10) (where (sql-and t)))