Commit 5fa0ca1d authored by Dave Cooper's avatar Dave Cooper
Browse files

added patch to fix update error when using :parameters

parent 64aa728a
(in-package :gwl-user)
(define-object presidents (base-ajax-sheet)
......@@ -19,7 +20,8 @@
(str (the development-links))
((:table :border (the table-border))
(dolist (president (list-elements (the presidents)))
(htm (:tr (:td ((:a :href (the-object president url))(str (the-object president name-input value))))
(htm (:tr (:td ((:a :href (the-object president url))
(str (the-object president name-input value))))
(:td (str (the-object president term-input value))))))))))
......@@ -29,12 +31,7 @@
:listing-page self
:data (nth (the-child index) (the data))
:pseudo-inputs (data)
:name (getf (the-child data) :name)
:term (getf (the-child data) :term)
:parameters (the-child data))))
(define-object president (base-ajax-sheet)
......@@ -45,22 +42,16 @@
(with-cl-who-string ()
(when (the listing-page)
(htm (:p ((:a :href (the listing-page url)) "<-Back"))))
(:p (str (the name-input html-string)))
(:p (str (the term-input html-string)))
(str (the main-sheet-section main-div)))))
((main-sheet-section :type 'sheet-section
(with-cl-who-string ()
((:table :border (the table-border))
(:tr (:th "Name") (:th "Term"))
(:tr (:td (str (the name-input value)))
......@@ -76,3 +67,43 @@
(publish-gwl-app "/pres" 'presidents)
;; Following is a patch to fix the Update! error when using :parameters.
(in-package :gdl)
(defun %unbind-dependent-slots% (object slot &key updating?)
(let ((current (gethash (list object slot) *unbound-slots*)))
(unless current
(setf (gethash (list object slot) *unbound-slots*) t)
(if (slot-exists-p object slot)
(let ((slot-value (slot-value object slot)))
(when (not (eq (first (ensure-list slot-value)) 'gdl-rule:%unbound%))
(when (and *eager-setting-enabled?* (null (second slot-value)))
(push (list object slot) *leaf-resets*))
(let ((list-or-hash (second slot-value)))
(if (listp list-or-hash)
(mapc #'(lambda(notify-cons)
(destructuring-bind (node . messages) notify-cons
(mapc #'(lambda(message)
(%unbind-dependent-slots% node message
:updating? updating?))
messages))) list-or-hash)
(maphash #'(lambda(node messages)
(mapc #'(lambda(message)
(%unbind-dependent-slots% node message
:updating? updating?))
messages)) list-or-hash)))
(if (third slot-value)
(setf (second (slot-value object slot)) nil)
(setf (slot-value object slot)
(if (or updating? (not (the-object object remember-children?))
(not *remember-previous-slot-values?*))
(list 'gdl-rule::%unbound% nil nil (first (slot-value object slot))))))))
(when (and (find-class 'gdl-remote nil) (typep object 'gdl-remote))
(the-object object (unbind-remote-slot slot)))))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment