Jifty::Plugin::SkeletonApp::Dispatcher - Dispatcher for SkeletonApp plugin


Jifty documentation Contained in the Jifty distribution.

Index


Code Index:

NAME

Top

Jifty::Plugin::SkeletonApp::Dispatcher - Dispatcher for SkeletonApp plugin

DESCRIPTION

Top

Elementary things for a basic app.

RULES

Top

on '**'

Add 'Home' item to the top navigation unless it's there already.

before '**'

Sets language of the current session if the request has '_jifty_lang' argument.


Jifty documentation Contained in the Jifty distribution.
use warnings;
use strict;

package Jifty::Plugin::SkeletonApp::Dispatcher;

use Jifty::Dispatcher -base;

on '**' => run {
    my $top = Jifty->web->navigation;

    # Do not override the 'Home' menu item if the app had set it already
    unless ( $top->child('Home') ) {
        $top->child( Home => url => "/", sort_order => 1, label => _('Home') );
    }
    return ();
};

before '**' => run {
    if (my $lang = Jifty->web->request->arguments->{_jifty_lang}) {
        Jifty->web->session->set(jifty_lang => $lang);
    }
};

1;