sub process {
my ($class, $r) = @_;
- $r->template( my $method = $r->action );
- $r->objects([ $class->retrieve(shift @{$r->{args}}) ]);
- $class->$method($r);
+ my $method = $r->action;
+ return if $r->{template}; # Authentication has set this, we're done.
+
+ $r->{template} = $method;
+ $r->objects([]);
+ my $obj = $class->retrieve( $r->{args}->[0] );
+ if ($obj) {
+ $r->objects([ $obj ]);
+ shift @{$r->{args}};
+ }
+ $class->$method($r, $obj, @{$r->{args}});
+}
+
+sub display_columns {
+ sort shift->columns;
}
=head1 NAME
=head2 columns
-This is a list of the columns in a table.
+This is a list of all the columns in a table. You may also override
+C<display_columns>, which is the list of columns you want to view, in
+the right order.
=head2 table
=cut
-sub column_names { my $class = shift; map { $_ => ucfirst $_ } $class->columns }
+sub column_names { my $class = shift; map {
+ my $col = $_;
+ $col =~ s/_+(\w)?/ \U$1/g;
+ $_ => ucfirst $col } $class->columns }
=head2 description