]> git.decadent.org.uk Git - maypole.git/blobdiff - ex/fancy_example/BeerDB/Base.pm
Beginning to a fancy example app of 2.11 features . See
[maypole.git] / ex / fancy_example / BeerDB / Base.pm
diff --git a/ex/fancy_example/BeerDB/Base.pm b/ex/fancy_example/BeerDB/Base.pm
new file mode 100644 (file)
index 0000000..0f980d9
--- /dev/null
@@ -0,0 +1,18 @@
+package BeerDB::Base;
+use base qw/Maypole::Model::CDBI/;
+use strict;
+use warnings;
+
+# Overide list to add display_columns to cgi  
+# Perhaps do this in AsForm?
+
+sub list : Exported {
+       use Data::Dumper;
+       my ($self, $r) = @_;
+       $self->SUPER::list($r);
+       my %cols =  map { $_ => 1 } $self->columns, $self->display_columns;
+       my @cols = keys %cols;
+       $r->template_args->{classmetadata}{cgi} = { $self->to_cgi(@cols) }; 
+}
+
+1;