]> git.decadent.org.uk Git - maypole.git/blobdiff - templates/factory/macros
Fix to check that a has_a points to another Model object.
[maypole.git] / templates / factory / macros
index 1e5994f0e2a6f8de66b18c852a3284f56e544e2b..4a90e1771f4f1ae9e2c60cb20a2ee009dfaca165 100644 (file)
@@ -34,8 +34,8 @@ 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);
+    IF object.isa('Maypole::Model::Base');
+        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 class='actions' nowrap>";
+    '<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 %]
 [%#