]> git.decadent.org.uk Git - maypole.git/blobdiff - templates/factory/macros
Link to has-many objects in the view page.
[maypole.git] / templates / factory / macros
index 2a2315523300949de9c7b48f103f28367a4cf9b9..044ba456ad44c4d82016e6abd526920db94d04a0 100644 (file)
@@ -34,3 +34,14 @@ END %]
 </TD>
 [% END %]
 
+[% MACRO view_related(object) BLOCK;
+    FOR accessor = classmetadata.related_accessors.list;
+        "<H3>"; accessor | ucfirst; "</H3>\n";
+        "<UL id=\"vlist\">";
+        FOR thing = object.$accessor;
+            "<LI>"; maybe_link_view(thing); "</LI>\n";
+        END;
+        "</UL>";
+    END; 
+END;
+%]