[Jifty-commit] r5468 - in jifty/trunk/lib/Jifty/Plugin: AdminUI
Jifty commits
jifty-commit at lists.jifty.org
Fri May 16 08:59:30 EDT 2008
Author: ruz
Date: Fri May 16 08:59:29 2008
New Revision: 5468
Added:
jifty/trunk/lib/Jifty/Plugin/AdminUI/Dispatcher.pm
Modified:
jifty/trunk/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
Log:
* move adding AdminUI menu item from SkeletonApp to AdminUI's plugin dispatcher
* update docs
Added: jifty/trunk/lib/Jifty/Plugin/AdminUI/Dispatcher.pm
==============================================================================
--- (empty file)
+++ jifty/trunk/lib/Jifty/Plugin/AdminUI/Dispatcher.pm Fri May 16 08:59:29 2008
@@ -0,0 +1,41 @@
+use warnings;
+use strict;
+
+package Jifty::Plugin::AdminUI::Dispatcher;
+
+=head1 NAME
+
+Jifty::Plugin::AdminUI::Dispatcher - dispatcher of the AdminUI plugin
+
+=head1 DESCRIPTION
+
+Adds dispatching rules required for the AdminUI plugin.
+
+=cut
+
+use Jifty::Dispatcher -base;
+
+=head1 RULES
+
+=head2 on '**'
+
+Adds 'Administration' item to the top navigation if AdminMode is activated in the config.
+
+=cut
+
+on '**' => run {
+ my $top = Jifty->web->navigation;
+ # for now leave check here, but we want AdminUI to be
+ # real plugin someday
+ if ( Jifty->config->framework('AdminMode') ) {
+ $top->child(
+ Administration =>
+ url => "/__jifty/admin/",
+ label => _('Administration'),
+ sort_order => 998,
+ );
+ }
+ return ();
+};
+
+1;
Modified: jifty/trunk/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm Fri May 16 08:59:29 2008
@@ -9,14 +9,19 @@
=head1 DESCRIPTION
-When a user asks for /, give them index.html.
+Elementary things for a basic app.
=cut
-
use Jifty::Dispatcher -base;
-
+=head1 RULES
+
+=head2 on '**'
+
+Add 'Home' item to the top navigation unless it's there already.
+
+=cut
on '**' => run {
my $top = Jifty->web->navigation;
@@ -25,18 +30,15 @@
unless ( $top->child('Home') ) {
$top->child( Home => url => "/", sort_order => 1, label => _('Home') );
}
-
- if ( Jifty->config->framework('AdminMode') ) {
- $top->child(
- Administration =>
- url => "/__jifty/admin/",
- label => _('Administration'),
- sort_order => 998
- );
- }
return ();
};
+=head2 before '**'
+
+Sets language of the current session if the request has '_jifty_lang' argument.
+
+=cut
+
before '**' => run {
if (my $lang = Jifty->web->request->arguments->{_jifty_lang}) {
Jifty->web->session->set(jifty_lang => $lang);
More information about the Jifty-commit
mailing list