From 5b439f6cd78f1565e380151e102f05941cd02fd6 Mon Sep 17 00:00:00 2001
From: Simon Cozens <simon@simon-cozens.org>
Date: Mon, 6 Dec 2004 22:38:11 +0000
Subject: [PATCH] support compound primary keys in factory templates

git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@302 48953598-375a-da11-a14b-00016c27c3ee
---
 Changes                  | 6 ++++--
 templates/factory/macros | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Changes b/Changes
index a653e99..75c2a52 100644
--- a/Changes
+++ b/Changes
@@ -7,8 +7,10 @@ Revision history for Perl extension Maypole
       Maypole::Model::CDBI::Plain (Dave Howorth)
     - Added Apache::RequestIO to Apache::MVC (michael@diaspora.gen.nz)
     - Applied patch to fix length of utf8 documents.
-    - added a new override for the model, fetch_objects. 
-    - support MCPKs in  CDBI fetch_objects.
+    - added a new override for the model: fetch_objects. 
+    - support compound primary keys in CDBI fetch_objects.
+    - add support for compound primary keys in factory templates
+      (Dagfinn Ilmari Mannsåker)
 
 2.04  Tue Oct 27 14:00:00 2004
     - fixed Apache::MVC version (Randal Schwartz)
diff --git a/templates/factory/macros b/templates/factory/macros
index 357c329..e7396d3 100644
--- a/templates/factory/macros
+++ b/templates/factory/macros
@@ -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;
@@ -81,7 +81,7 @@ This is a generic button, which performs an action on an object.
 
 #%]
 [% MACRO button(obj, action) BLOCK; %]
-<form class="actionform" action="[% base %]/[% obj.table %]/[% action %]/[% obj.id %]" method="post">
+<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 %]
 [%#
-- 
2.39.5