Added standard-wrappers.lisp for 'wrapper' displays
[clinton/lisp-on-lines.git] / src / standard-wrappers.lisp
diff --git a/src/standard-wrappers.lisp b/src/standard-wrappers.lisp
new file mode 100644 (file)
index 0000000..e0f44f6
--- /dev/null
@@ -0,0 +1,28 @@
+(in-package :lisp-on-lines)
+
+;;;;; Wrap a display in "back buttons"
+(deflayer wrap-back-buttons)
+
+(defdisplay (:in-layer
+            wrap-back-buttons
+            :combination :around)
+  (<ucw:a :class "wiz-button previous" :action (ok component t)
+         (<:as-html "Go Back"))
+  (<:div :style "clear:both;"
+        (call-next-method))
+  (<ucw:a :class "wiz-button previous" :action (ok component t)
+         (<:as-html "Go Back")))
+
+;;;; Wrap an object display in with a link to the object
+
+(deflayer wrap-link)
+
+(defdisplay (:in-layer
+            wrap-link
+            :combination :around)
+  (let ((layers  (find-display-layers object)))
+    (<ucw:a :action (call-display component object
+                                 :type (find-display-type object)
+                                 :layers layers)
+                                
+           (call-next-method))))
\ No newline at end of file