]> git.decadent.org.uk Git - maypole.git/blobdiff - templates/factory/list_macros
Here are the templates!
[maypole.git] / templates / factory / list_macros
diff --git a/templates/factory/list_macros b/templates/factory/list_macros
new file mode 100644 (file)
index 0000000..0a88996
--- /dev/null
@@ -0,0 +1,22 @@
+[% MACRO display_line(item) BLOCK;
+     FOR col = classmetadata.columns;
+        NEXT IF col == "id";
+        "<td>";
+        "<A HREF='" _ base _ item.$col.moniker _ "/view/" _ 
+            item.$col.id _"'>" IF item.$col.moniker; # it's an object
+        item.$col;
+        "</A>" IF item.$col.moniker; 
+        "</td>";
+     END;
+    button(item, "edit");
+    button(item, "delete");
+END %]
+[% MACRO button(obj, action) BLOCK; %]
+
+<TD>
+<FORM METHOD="post" ACTION="[%base%]/[%classmetadata.moniker%]/[%action%]/[%obj.id%]">
+    <INPUT TYPE="submit" NAME="[%action%]" VALUE="[%action%]">
+</FORM>
+</TD>
+[% END %]
+