From c21945575be63a9cf0b84d74b7b223ca2b02f8a5 Mon Sep 17 00:00:00 2001 From: Aaron Trevena Date: Mon, 12 Jun 2006 10:00:34 +0000 Subject: [PATCH] added object method to templates git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@492 48953598-375a-da11-a14b-00016c27c3ee --- Changes | 1 + lib/Maypole/View/TT.pm | 2 +- lib/Maypole/templates/factory/edit | 10 ++++------ lib/Maypole/templates/factory/view | 12 +++++------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Changes b/Changes index 53feab1..b8304b0 100644 --- a/Changes +++ b/Changes @@ -59,6 +59,7 @@ API additions and enhancements: - Improved factory templates - added the status() attribute, although it's not used in many places yet + - Changed factory edit/view to use object instead of objects Maypole::Model::CDBI - improved error messages in do_edit action diff --git a/lib/Maypole/View/TT.pm b/lib/Maypole/View/TT.pm index f634ca8..a1484d5 100644 --- a/lib/Maypole/View/TT.pm +++ b/lib/Maypole/View/TT.pm @@ -57,7 +57,7 @@ sub report_error { $r->{config} ||= {}; } if ($tt->process(\$error_template, - { err_type => $type, error => $error, + { err_type => $type, error => $error, config => $r->{config}, request => $r, eval{$self->vars($r)} }, \$output )) { diff --git a/lib/Maypole/templates/factory/edit b/lib/Maypole/templates/factory/edit index 14f77be..2016bb1 100644 --- a/lib/Maypole/templates/factory/edit +++ b/lib/Maypole/templates/factory/edit @@ -16,17 +16,16 @@ form similar to L but with the current values filled in. [% INCLUDE navbar %] [% END %] -[% IF objects.size %] +[% IF object %]
Edit a [% classmetadata.moniker %]
-[% FOR item = objects; %]
-Edit [% item.name %] -[% FOR col = classmetadata.columns; +Edit [% object.name %] + [% FOR col = classmetadata.columns; NEXT IF col == "id" OR col == classmetadata.table _ "_id"; '"; IF errors.$col; ''; errors.$col;''; @@ -36,7 +35,6 @@ form similar to L but with the current values filled in.
- [% END %] [% ELSE %]
diff --git a/lib/Maypole/templates/factory/view b/lib/Maypole/templates/factory/view index 328678c..9f06086 100644 --- a/lib/Maypole/templates/factory/view +++ b/lib/Maypole/templates/factory/view @@ -10,8 +10,7 @@ C and displays the object's properties in a table. #%] [% PROCESS macros %] [% INCLUDE header %] -[% FOR item = objects %] -[% view_item(item); %] +[% view_item(object); %] [%# =for doc @@ -23,12 +22,11 @@ a list of has-many accessors. Next it calls each of those accessors, and displays the results in a table. #%] -
Back to listing -[% view_related(item); %] +
Back to listing +[% view_related(object); %] [% - button(item, "edit"); - button(item, "delete"); + button(object, "edit"); + button(object, "delete"); %] -[% END; %] [% INCLUDE footer %] -- 2.39.5