(defmethod find-foreign-instances ((slot foreign-key-slot-presentation))
- (clsql:select (class-name (class-of (meta-model:explode-foreign-key (instance slot) (slot-name slot))))))
+ (clsql:select (class-name (class-of (meta-model:explode-foreign-key (instance slot) (slot-name slot))))
+ :order-by (car (list-keys (instance slot)))))
(defmethod get-foreign-instances ((slot has-many-slot-presentation) instance)
(sort (slot-value instance (slot-name slot)) #'<
- :key #'(lambda (x) (funcall (car (list-keys instance)) x))))
+ :key #'(lambda (x) (funcall (car (list-keys x)) x))))
(defmethod lol::presentation-slot-value ((slot has-many-slot-presentation) instance)
(get-foreign-instances slot instance))
(let ((instances (slot-value instance (slot-name slot)))
new-instance)
(<:ul
- (<:li (<ucw:button :action (add-to-many-to-many slot instance)
- (<:as-html "Add New")))
- (<:li (<ucw:button :action (add-to-many-to-many slot instance new-instance)
- (<:as-html "Add:"))
+ (<:li (<ucw:submit :action (add-to-many-to-many slot instance)
+
+ :value "Add New"))
+ (<:li (<ucw:submit :action (add-to-many-to-many slot instance new-instance)
+ :value "Add:")
(<ucw:select :accessor new-instance
(arnesi:dolist* (i (find-all-instances slot instance))
(<ucw:option
(<:as-html "(view) "))
(<ucw:a :action (delete-relationship slot (second i) instance)
(<:as-html "(remove) "))
- (present-view ((car i) (list-view slot) (ucw::parent slot)))) ))))
+ (present-view ((car i) (list-view slot) (ucw::parent slot))))))))
(defaction add-to-many-to-many ((slot many-to-many-slot-presentation) instance &optional foreign-instance)