[Maypole-dev] [PATCH] Template fixes for compound primary keys

From: Dagfinn Ilmari Mannsåker (ilmari at ilmari.org)
Date: Mon Dec 06 2004 - 13:15:06 GMT


This patch fixes links and action buttons for tables with compound
primary keys. TT will DTRT for join on scalars, so there's no need to
check if object.id actually is compound.

Index: templates/factory/macros
===================================================================
--- templates/factory/macros (revision 294)
+++ templates/factory/macros (working copy)
@@ -35,7 +35,7 @@
 [%
 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;
@@ -81,7 +81,7 @@
 
 #%]
 [% MACRO button(obj, action) BLOCK; %]
-<DEFANGED_form class="actionform" action="[% base %]/[% obj.table %]/[% action %]/[% obj.id %]" method="post">
+<DEFANGED_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 %]
 [%#

-- 
ilmari

_______________________________________________ maypole-dev mailing list maypole-dev at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole-dev



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT