]> git.decadent.org.uk Git - maypole.git/blobdiff - templates/factory/macros
support compound primary keys in factory templates
[maypole.git] / templates / factory / macros
index 234b8f92e512f686ec11fab6e674dedad21781b3..e7396d3365d3732d568d494d6e3d5a469cba7042 100644 (file)
@@ -35,7 +35,7 @@ command for that object. Otherwise, it just displays the data.
 [%
 MACRO maybe_link_view(object) BLOCK;
     IF object.table; # It's an object, i.e. a has-a
-        link(object.table, "view", object.id, object);
+        link(object.table, "view", object.id.join('/'), object);
     ELSE;
         object;
     END;
@@ -54,7 +54,7 @@ for some.
 
 #%]
 [% MACRO display_line(item) BLOCK;
-    FOR col = classmetadata.columns;
+    FOR col = classmetadata.list_columns;
         NEXT IF col == "id";
         "<td>";
         IF col == "url" AND item.url;
@@ -66,7 +66,7 @@ for some.
         END;
         "</td>";
     END;
-    "<td>";
+    '<td class="actions">';
     button(item, "edit");
     button(item, "delete");
     "</td>";
@@ -81,8 +81,8 @@ This is a generic button, which performs an action on an object.
 
 #%]
 [% MACRO button(obj, action) BLOCK; %]
-<a class="action" href="[% base %]/[% obj.table %]/[% action %]/[% obj.id %]">
-    [% action %]</a>
+<form class="actionform" action="[% base %]/[% obj.table %]/[% action %]/[% obj.id.join('/') %]" method="post">
+<div class="field"><input class="actionbutton" type="submit" value="[% action %]" /></div></form>
 [% END %]
 [%#
 
@@ -99,7 +99,7 @@ brewery) calls the accesor, and displays a list of the results.
 [% 
 MACRO view_related(object) BLOCK;
     FOR accessor = classmetadata.related_accessors.list;
-        "<h3>"; accessor | ucfirst; "</h3>\n";
+        "<div id=\"subtitle\">"; accessor | ucfirst; "</div>\n";
         "<ul id=\"vlist\">";
         FOR thing = object.$accessor;
             "<li>"; maybe_link_view(thing); "</li>\n";