[Catalyst-commits] r7695 - in
CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk: .
lib/CatalystX/CRUD/View
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Tue May 6 20:09:34 BST 2008
Author: karpet
Date: 2008-05-06 20:09:34 +0100 (Tue, 06 May 2008)
New Revision: 7695
Modified:
CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/lib/CatalystX/CRUD/View/Excel.pm
Log:
0.04 release
Modified: CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/Changes 2008-05-06 19:03:27 UTC (rev 7694)
+++ CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/Changes 2008-05-06 19:09:34 UTC (rev 7695)
@@ -10,9 +10,11 @@
0.03 21 Dec 2007
* fix INCLUDE -> INCLUDE_PATH bug (it was wrong in ETP docs)
-0.04 xxx
+0.04 06 May 2008
* escape all values with 'html' filter in default template
+ * support iterator as well as results arrayref
+
Modified: CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/lib/CatalystX/CRUD/View/Excel.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/lib/CatalystX/CRUD/View/Excel.pm 2008-05-06 19:03:27 UTC (rev 7694)
+++ CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/lib/CatalystX/CRUD/View/Excel.pm 2008-05-06 19:09:34 UTC (rev 7695)
@@ -2,7 +2,10 @@
use warnings;
use strict;
-use base qw( Catalyst::View::Excel::Template::Plus CatalystX::CRUD );
+use base qw(
+ Catalyst::View::Excel::Template::Plus
+ CatalystX::CRUD
+);
use Path::Class;
our $VERSION = '0.04';
@@ -167,6 +170,13 @@
my ( $self, $c ) = @_;
my $tmpl = <<TT;
+[% BLOCK make_row %]
+ <row>
+ [% FOR fn = myfields %]
+ <cell>[% r.\$fn | html %]</cell>
+ [% END %]
+ </row>
+[% END %]
<workbook>
<worksheet name="[% c.controller.model_name.replace('\\W+','_') %]">
[% myfields = c.controller.field_names %]
@@ -175,13 +185,16 @@
<bold><cell>[% fn | html %]</cell></bold>
[% END %]
</row>
- [% FOR r = results.results %]
- <row>
- [% FOR fn = myfields %]
- <cell>[% r.\$fn | html %]</cell>
- [% END %]
- </row>
- [% END %]
+ [% IF results.iterator;
+ WHILE (r = results.iterator.next);
+ PROCESS make_row;
+ END;
+ ELSE;
+ FOR r = results.results;
+ PROCESS make_row;
+ END;
+ END;
+ %]
</worksheet>
</workbook>
TT
More information about the Catalyst-commits
mailing list