[dancer-users] Dancer::Plugin::SimpleCRUD use of template

David Precious davidp at preshweb.co.uk
Mon Mar 10 10:04:27 GMT 2014

On Mon, 10 Mar 2014 10:55:46 +0100
Gert van Oss <gertvanoss at me.com> wrote:
> I see, though my main.tt layout is still in the background. I guess
> that whatever template in the /views the plugin always uses the
> main.tt as layout? As I was confused by the docs saying:
> Any global layout will be applied automatically because this option
> causes the module to use the template keyword.

Yeah - that used to be the case - looks like when I changed the code to
always apply layout I forgot to update that bit of the docs.  Will sort
that out - ta.

The bit of D::P::SimpleCRUD's code that does that is:

    sub _apply_template {
        my ($html, $template) = @_;

        if ($template) {
            return template $template, { simple_crud => $html };
        } else {
            return engine('template')->apply_layout($html);

> Changing look of the template comes down to changing to code in the
> SimpleCrud.pm I see. 

You should be able to do quite a bit just with your CSS, to be fair.

I had thought there was an option to provide additional options to
HTML::Table::FromDatabase when rendering the table to view records, so
you could e.g. give that table a specific ID, or alternating classes
for even & odd rows, etc - if that would be useful I can add that.


Dave P

More information about the dancer-users mailing list