X-Git-Url: http://git.ieval.ro/?p=gruntmaster-page.git;a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FGeneric.pm;h=36ca445a98c00c26ee4cae0b3b5190936d56d75d;hp=9c5687b2b705ab77622da9217b453e9df41f1e05;hb=a46fb222e6ce50102b7c61a95af435afc74f5e33;hpb=58a0ba09590653e5afceb39431f7fa893d26c86f diff --git a/lib/Gruntmaster/Page/Generic.pm b/lib/Gruntmaster/Page/Generic.pm index 9c5687b..36ca445 100644 --- a/lib/Gruntmaster/Page/Generic.pm +++ b/lib/Gruntmaster/Page/Generic.pm @@ -42,7 +42,10 @@ sub list { @params{'page', 'pages'} = ($page, $pages); $rs = $rs->search(undef, {offset => ($page - 1) * PAGE_SIZE, ($page == $pages ? () : (rows => PAGE_SIZE))}); } - $rs = $rs->search(undef, {prefetch => $thing{prefetch}}) if exists $thing{prefetch}; + $rs = $rs->search(undef, { + exists $thing{prefetch} ? (prefetch => $thing{prefetch}) : (), + exists $thing{columns} ? (columns => $thing{columns}) : (), + }); my @thing = map +{rs => $_, $_->get_columns}, $rs->all; @thing = map { $thing{mangle}->(); $_ } @thing if exists $thing{mangle}; @thing = grep { $thing{choose}->() } @thing if exists $thing{choose}; @@ -86,6 +89,7 @@ sub sortby (&); sub group (&); sub mangle (&); sub prefetch; +sub columns; sub thing (&){ my %thing; @@ -97,6 +101,7 @@ sub thing (&){ local *{"group"} = sub { $thing{group} = shift }; local *{"makers"} = sub { $thing{makers} = shift }; local *{"prefetch"} = sub { $thing{prefetch} = \@_ }; + local *{"columns"} = sub { $thing{columns} = \@_ }; use strict 'refs'; shift->();