NAME

Strehler::Dancer2::Plugin::Admin - Dancer2 Plugin to write new routes in the Strehler Backend

DESCRIPTION

Dancer2 Strehler Admin plugin allows you to write an app with new routes to be used in Strehler Backend, protected with Strehler login, and rendered with the Strehler context.

This element hasn't the standard Dancer2::Plugin namespace because it makes sense only in a Strehler system.

SYNOPSIS

package MyBackend;

use Dancer2;
use Strehler::Dancer2::Plugin::Admin; 

If you want to write a module like this, you have to launch the command

strehler layout

under your Dancer2 App, to copy Strehler Layout in it, making it available for your developements.

HOW TO CUSTOMIZE STREHLER BACKEND HOMEPAGE

Strehler homepage is empty and really dumb. Probably there're informations you want to display on it or shortcut for your navigation.

To do this you can:

  1. Launch strehler layout command in your Dancer2 App.

    strehler layout
  2. Write a view for the homepage like this:

    views/strelher-home.tt

    <div class="span10">
        <h1>My wonderful homepage</h1>
        <div>Lorem ipsum...</div> 
    </div>
  3. Write a module with Strehler::Dancer2::Plugin::Admin overriding '/' route, calling the new template.

    lib/MyBackend.pm

    package MyBackend;
    use Dancer2;
    use Strehler::Dancer2::Plugin::Admin;
    
    get '/' => sub {
        template 'strehler-home';
    };
    
    true;
  4. Include the module above Strehler::Admin in your application file.

    bin/app.pl

    #!/usr/bin/env perl
    
    use FindBin;
    use lib "$FindBin::Bin/../lib";
    
    use MyBackend;
    use Strehler::Admin;
    MyBackend->dance;