(in-package :kira) (defclass quote (node) ((attribution :accessor attribution :initarg :attribution :initform nil))) (defcollection quotes ((entity quotes-mixin)) (cached-collection entity 'quotes :descending t)) (defhandler ((entity quotes-mixin) :quotes) (:title "Quotes") (:p (render-link entity 'create :type 'quote)) (:collection (quotes entity))) (defmethod render-in-style ((quote quote) (style (eql 'html))) (html ((:div :class "quote") (render-markup (body quote) :anonymous-first-block-p t) ((:p :class "attribution") "—" (render-inline-markup (attribution quote)) (:when (uri-authorized-p quote 'edit) " " (:small "[" (render-link quote 'edit) "]")))))) (defmethod render-in-style ((quote quote) (style (eql 'sidebar))) (render-in-style quote 'html)) (defmethod render-editor ((quote quote)) (html (:field "Quote" (markup-field 'body quote)) (:field "Attribution" (text-field 'attribution quote)))) (defmethod update-instance-from-query progn ((quote quote)) (setf-accessors-from-query quote attribution)) (define-update-methods instance ((entity quotes-mixin) (quote quote)) (update-collection (quotes entity) quote)) (defmethod text ((quote quote) (symbol (eql 'realize))) "Add")