[Catalyst-commits] r7921 - in
CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk: .
lib/CatalystX/CRUD/View
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Fri Jun 13 15:03:23 BST 2008
Author: karpet
Date: 2008-06-13 15:03:23 +0100 (Fri, 13 Jun 2008)
New Revision: 7921
Modified:
CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/Makefile.PL
CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/lib/CatalystX/CRUD/View/Excel.pm
Log:
support for CX::CRUD::Results in CX::CRUD 0.27
Modified: CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/Makefile.PL
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/Makefile.PL 2008-06-13 13:32:59 UTC (rev 7920)
+++ CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/Makefile.PL 2008-06-13 14:03:23 UTC (rev 7921)
@@ -10,7 +10,7 @@
PL_FILES => {},
PREREQ_PM => {
'Test::More' => 0,
- 'CatalystX::CRUD' => 0.17,
+ 'CatalystX::CRUD' => 0.27,
'Catalyst::View::Excel::Template::Plus' => 0,
'Path::Class' => 0,
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-06-13 13:32:59 UTC (rev 7920)
+++ CatalystX-CRUD/CatalystX-CRUD-View-Excel/trunk/lib/CatalystX/CRUD/View/Excel.pm 2008-06-13 14:03:23 UTC (rev 7921)
@@ -2,9 +2,9 @@
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;
@@ -84,10 +84,10 @@
my $template = $self->get_template_filename($c);
( defined $template )
- || die 'No template specified for rendering';
+ || $self->throw_error('No template specified for rendering');
# does $template exist? otherwise create one ad-hoc
- unless ( $self->template_exists($template) ) {
+ unless ( $self->template_exists( $c, $template ) ) {
$template = \( $self->results_template($c) );
}
@@ -120,9 +120,12 @@
=cut
sub template_exists {
- my ( $self, $template ) = @_;
+ my ( $self, $c, $template ) = @_;
for my $path ( @{ $self->etp_config->{INCLUDE_PATH} } ) {
- return 1 if -s file( $path, $template );
+ if ( -s file( $path, $template ) ) {
+ $c->log->debug("using Excel template: $template") if $c->debug;
+ return 1;
+ }
}
return 0;
}
@@ -179,22 +182,16 @@
[% END %]
<workbook>
<worksheet name="[% c.controller.model_name.replace('\\W+','_') %]">
- [% myfields = c.controller.field_names %]
+ [% myfields = c.controller.field_names(c) %]
<row>
[% FOR fn = myfields %]
<bold><cell>[% fn | html %]</cell></bold>
[% END %]
</row>
- [% IF results.iterator;
- WHILE (r = results.iterator.next);
- PROCESS make_row;
- END;
- ELSE;
- FOR r = results.results;
- PROCESS make_row;
- END;
+ [% WHILE (r = results.next);
+ PROCESS make_row;
END;
- %]
+ %]
</worksheet>
</workbook>
TT
More information about the Catalyst-commits
mailing list