Sledge::View 0.04 released

tokuhirom on 2006-11-03T14:41:29

I released Sledge::View 0.04 released.

This distribution includes the Sledge::View::CSV.

yeah, Japanese sales person often requires the CSV formatted files ;-)

usage:

package Your::Pages::Admin::Report;
use strict;
use warnings;
use base qw/Sledge::Pages::Compat/;
use Sledge::Plugin::View;
use Sledge::Plugin::Stash;

__PACKAGE__->add_trigger( AFTER_DISPATCH => sub { my $self = shift; if ($self->r->param('output') eq 'csv') { $self->view('CSV')->process; } else { $self->view('Template')->process; } } );

sub dispatch_report { my $self = shift; $self->stash->{row} = [[qw/a b/], [qw/c d/]]; }



and, your template is:


  [% FOR row IN rows %]
  
    [% FOR col IN row %]
    
    [% END %]
  
  [% END %]
[% col %]


if user access to '/admin/report/report' then get the html table report, and if access to '/admin/report/report?output=csv' then get the csv report.

yes, you can easy to change the view.