2 |
use Jifty::Dispatcher -base; |
use Jifty::Dispatcher -base; |
3 |
|
|
4 |
# Default page |
# Default page |
5 |
on '/', run { |
#on '/', run { |
6 |
redirect( '/transport'); |
# redirect( '/new'); |
7 |
}; |
#}; |
8 |
|
|
9 |
on '/all_transports', run { |
=head1 Login and logout operations |
|
my $transports = Transports::Model::TransportCollection->new(); |
|
|
$transports->unlimit(); |
|
10 |
|
|
11 |
set transports => $transports; |
=head2 login |
|
}; |
|
12 |
|
|
13 |
|
=cut |
14 |
|
|
15 |
|
on qr'^/login', run { |
16 |
|
|
|
# Login |
|
|
on 'login', run { |
|
17 |
set 'action' => |
set 'action' => |
18 |
Jifty->web->new_action( class => 'Login', moniker => 'loginbox' ); |
Jifty->web->new_action( class => 'Login', moniker => 'loginbox' ); |
19 |
set 'next' => Jifty->web->request->continuation |
set 'next' => Jifty->web->request->continuation |
20 |
|| Jifty::Continuation->new( |
|| Jifty::Continuation->new( |
21 |
request => Jifty::Request->new( path => "/" ) ); |
request => Jifty::Request->new( path => '/transports' ) ); |
22 |
|
show '/login'; |
23 |
}; |
}; |
24 |
|
|
25 |
# Log out |
=head2 logout |
26 |
|
|
27 |
|
=cut |
28 |
|
|
29 |
before 'logout', run { |
before 'logout', run { |
30 |
Jifty->web->request->add_action( |
Jifty->web->request->add_action( |
31 |
moniker => 'logout', |
moniker => 'logout', |
33 |
); |
); |
34 |
}; |
}; |
35 |
|
|
36 |
|
|
37 |
|
# These are dispatcher rules that halos and error handling need to be |
38 |
|
# able to edit files in place. These should become a plugin of some |
39 |
|
# sort, when we have that infrastructure. |
40 |
|
|
41 |
|
before qr'^(.*)$', run { |
42 |
|
my $url = $1 || '/'; |
43 |
|
|
44 |
|
Jifty->api->allow(qr/^Jifty::Action::Devel/) |
45 |
|
if Jifty->config->framework('DevelMode'); |
46 |
|
|
47 |
|
return if ($url eq '/' || $url =~ m#^/login#); |
48 |
|
|
49 |
|
if (not Jifty->web->current_user->id) { |
50 |
|
Jifty->web->tangent( url => '/login' ); |
51 |
|
} |
52 |
|
}; |
53 |
|
|
54 |
|
on qr'^/__jifty/edit/(.*?)/(.*)$', run { |
55 |
|
my $editor = Jifty->web->new_action( |
56 |
|
class => 'Jifty::Action::Devel::FileEditor', |
57 |
|
moniker => 'editpage', |
58 |
|
arguments => { |
59 |
|
source_path => $2, |
60 |
|
file_type => $1, |
61 |
|
} |
62 |
|
); |
63 |
|
|
64 |
|
set editor => $editor; |
65 |
|
show '/__jifty/edit_file'; |
66 |
|
}; |
67 |
|
|
68 |
1; |
1; |