[Jifty-commit] r525 - in wifty/trunk: lib/Wifty web/templates
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Jan 23 17:29:35 EST 2006
Author: alexmv
Date: Mon Jan 23 17:29:35 2006
New Revision: 525
Modified:
wifty/trunk/ (props changed)
wifty/trunk/lib/Wifty/Dispatcher.pm
wifty/trunk/web/templates/autohandler
Log:
r8775 at zoq-fot-pik: chmrr | 2006-01-23 17:28:57 -0500
* Clean up to work with most recent dispatcher, etc
Modified: wifty/trunk/lib/Wifty/Dispatcher.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Dispatcher.pm (original)
+++ wifty/trunk/lib/Wifty/Dispatcher.pm Mon Jan 23 17:29:35 2006
@@ -1,15 +1,24 @@
package Wifty::Dispatcher;
use Jifty::Dispatcher -base;
-on '/', redirect( '/view/HomePage');
+# Generic restrictions
+under '/', run {
+ Jifty->web->deny_actions('Wifty::ConfirmEmail');
+};
+
+# Default page
+on '/', run {
+ redirect( '/view/HomePage');
+};
+# Create a page
on '/create/*', run {
set page => $1;
set action => Jifty->web->new_action( class => 'CreatePage' );
show("/create");
};
-
+# View or edit a page
on qr{(view|edit)/(.*)}, run {
my ( $name, $rev );
my $page_name = $1;
@@ -28,6 +37,7 @@
show("/$page_name");
};
+# View page history
on 'history/*', run {
my $name = $1;
my $page = Wifty::Model::Page->new();
@@ -42,13 +52,14 @@
show('/history');
};
-
+# List pages
on 'pages', run {
my $pages = Wifty::Model::PageCollection->new();
$pages->unlimit();
set pages => $pages;
};
+# Show recent edits
on 'recent', run {
my $then = DateTime->from_epoch( epoch => ( time - ( 86400 * 7 ) ) );
my $pages = Wifty::Model::PageCollection->new();
@@ -61,6 +72,7 @@
set pages => $pages;
};
+# Sign up for an account
on 'signup', run {
redirect('/') if ( Jifty->web->current_user->id );
set 'action' =>
@@ -72,6 +84,7 @@
};
+# Login
on 'login', run {
set 'action' =>
Jifty->web->new_action( class => 'Login', moniker => 'loginbox' );
@@ -81,6 +94,7 @@
};
+# Log out
before 'logout', run {
Jifty->web->request->add_action(
moniker => 'logout',
Modified: wifty/trunk/web/templates/autohandler
==============================================================================
--- wifty/trunk/web/templates/autohandler (original)
+++ wifty/trunk/web/templates/autohandler Mon Jan 23 17:29:35 2006
@@ -4,20 +4,5 @@
$m->redirect("/errors/requested_private_component");
}
$m->comp('/_elements/nav');
-require Wifty::Dispatcher;
-Wifty::Dispatcher->handle_request();
-return;
+$m->call_next();
</%init>
-<%def .setup_actions>
-<%init>
-# XXX TODO: move all this into the dispatcher
-Jifty->web->allow_actions(qr/.*/);
-# this method turns around and calls the setup_actions method
-# it's called by Jifty::Web->setup_page_actions.
-my $delegate = $m->fetch_comp($m->next_comp->path);
-if ($delegate and $delegate->method_exists('setup_actions')) {
- $delegate->call_method('setup_actions');
-}
-
-</%init>
-</%def>
More information about the Jifty-commit
mailing list