blob: 0fea5f9aed46ad07821f76994d4ad83ca943656e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package intentioncloud::Controller::Root;
use strict;
use warnings;
use parent 'Catalyst::Controller';
__PACKAGE__->config->{ namespace } = '';
sub about : Local {
my ( $self, $c ) = @_;
$c->stash->{ template } = 'others/what.tt';
}
sub who : Local {
my ( $self, $c ) = @_;
$c->stash->{ template } = 'others/who.tt';
}
sub why : Local {
my ( $self, $c ) = @_;
$c->stash->{ template } = 'others/why.tt';
}
sub how : Local {
my ( $self, $c ) = @_;
$c->stash->{ template } = 'others/how.tt';
}
sub index : Local {
my ( $self, $c ) = @_;
$c->stash->{ template } = 'cloud/search.tt';
$c->stash(
last_clouds => [ $c->model( 'DB::Search' )->search()->slice( 0, 2 ) ]
);
}
sub lang : Regex('^lang/(\w{2})$') {
my ( $self, $c ) = @_;
my $lang = $c->req->captures->[ 0 ];
$c->languages( $lang );
$c->session->{ lang } = $lang;
if ( $c->session->{ referer } ) {
$c->stash->{ template } = $c->session->{ referer };
} else {
$c->forward( '/index' );
}
}
sub end : ActionClass('RenderView') {
my ( $self, $c ) = @_;
$c->session->{referer} = $c->stash->{template};
if (defined $c->session->{'lang'}){
$c->languages( [ $c->session->{'lang'} ]);
}
$c->forward( 'intentioncloud::View::TT' );
}
1;
|