root/lang/perl/Jipotter/trunk/lib/Jipotter/Plugin/Timelines/Dispatcher.pm @ 1810

Revision 1810, 1.0 kB (checked in by charsbar, 7 years ago)

lang/perl/Jipotter: several fixes including broken fav select; added BasePath? option to allow putting jipotter under subdirectory

  • Property svn:eol-style set to native
Line 
1package Jipotter::Plugin::Timelines::Dispatcher;
2
3use strict;
4use warnings;
5use Jifty::Dispatcher -base;
6use Jipotter::Util;
7
8my $base = Jipotter::Util->base_path;
9
10before qr{^(?:$base)?/timelines/post} => run {
11  Jifty->web->new_action(
12    class => 'Jipotter::Plugin::Timelines::Action::Post',
13    moniker => 'timelines_post'
14  )->run;
15
16  redirect $base.'/';
17};
18
19before qr{^(?:$base)?/timelines/search} => run {
20  Jifty->web->new_action(
21    class => 'Jipotter::Plugin::Timelines::Action::Search',
22    moniker => 'timelines_search'
23  )->run;
24
25  redirect $base.'/';
26};
27
28before qr{^(?:$base)?/timelines/region} => run {
29  my $type = Jifty->web->request->argument('type') || '';
30  if ( $type eq 'add' ) {
31    Jifty->web->new_action(
32      class => 'Jipotter::Plugin::Timelines::Action::AddFavorite',
33      moniker => 'timelines_add_favorite'
34    )->run;
35  }
36  elsif ( $type eq 'remove' ) {
37    Jifty->web->new_action(
38      class => 'Jipotter::Plugin::Timelines::Action::RemoveFavorite',
39      moniker => 'timelines_remove_favorite'
40    )->run;
41  }
42};
43
441;
Note: See TracBrowser for help on using the browser.