added the image attribute and a naive image picker
authorDrew Crampsie <drewc@tech.coop>
Thu, 12 Jan 2006 12:14:27 +0000 (04:14 -0800)
committerDrew Crampsie <drewc@tech.coop>
Thu, 12 Jan 2006 12:14:27 +0000 (04:14 -0800)
darcs-hash:20060112121427-5417e-2303e6848952e96813a2fc196c91516a197e435c.gz

src/standard-attributes.lisp
src/standard-display.lisp

index 10e3145..d855e9d 100644 (file)
@@ -3,14 +3,34 @@
 (defattribute image ()
   ())
 
+(defdisplay (:description (buttons (eql 'image-editor-buttons)))
+  (<ucw:a :action (ok component object)
+         (<:as-html "select this image")))
+
 (defdisplay (:description (image image))
   (<:img
-   :class (or (getp :class) "lol-image") 
+   :class (or (getp :css-class) "lol-image") 
    :src (arnesi:strcat
         (or (getp :prefix) "images/")
         (escape-as-uri
          (attribute-value object image)))))
 
+(defdisplay (:description (image image)
+            :in-layer editor)
+  (<:div
+   :class "lol-image-thumbnails"
+   
+  (dolist* (i (or (getp :directory)
+                 (cl-fad:list-directory (strcat *default-pathname-defaults* "wwwroot/images/"))))
+    (<:div
+     :style "border: 1px solid black;width:100px;"
+     (<:img
+      :width "90px"
+      :src (strcat (or (getp :prefix) "images/")
+                  (file-namestring i)))
+     (display-using-description 'image-editor-buttons component (file-namestring i) properties))
+    (<:p :style "clear:both;"))))
+
 
 
 
index 57347f8..9bcf3ff 100644 (file)
   `(call-component ,component (make-instance 'standard-display-component
                         :display #'(lambda (component)
                                      (with-component (component)
-                                       (<:as-html ,object)
-                                       (display ,object ,@args))))))
+                                       (display ,component ,object ,@args))))))
 
 (defmethod find-plist (object)
   (list))
-`
+
 (defmethod find-plist ((attribute standard-attribute))
+  (warn "atttributre plist ~A" (attribute.plist attribute))
   (attribute.plist attribute))
 
 (defmacro with-plist ((plist-form &optional prefix)  &body body)
     (loop for att in (or (o-getp :attributes) (list-slots object))
          do (let* ((att (ensure-list att))
                    (attribute (find-attribute occurence (first att))))
-              (warn "trying to render ~A in ~A" attribute object)
               (with-plist ((plist-union (rest att) (find-plist attribute)))
                 (<:p :class "attribute"
-                     (<:span :class "label" (<:as-html (getp :label) " "))        
+                     (and (getp :show-labels-p) (<:span :class "label" (<:as-html (or (getp :label) "")  " ")))           
                      (display-using-description
                       attribute
                       component
                       object
                       (rest att))))))))
 
+
+
+
 ;;;; ** One line
 (defdisplay (:in-layer one-line)
+  "The one line presentation just displays the attributes with a #\Space between them"
   (do-attributes (attribute occurence (or (getp :attributes)
                                          (list-slots object)))
        (display-using-description attribute component object (attribute-properties))
     (<ucw:submit :action (ok component)
                 :value "Ok."))
 
-
 (defdisplay (:in-layer wrap-form
                       :combination :around)
   (<ucw:form