summaryrefslogtreecommitdiff
path: root/lib/intentioncloud/Controller/Root.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/intentioncloud/Controller/Root.pm')
-rw-r--r--lib/intentioncloud/Controller/Root.pm25
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/intentioncloud/Controller/Root.pm b/lib/intentioncloud/Controller/Root.pm
index dda0092..0fea5f9 100644
--- a/lib/intentioncloud/Controller/Root.pm
+++ b/lib/intentioncloud/Controller/Root.pm
@@ -29,13 +29,32 @@ sub how : Local {
sub index : Local {
my ( $self, $c ) = @_;
$c->stash->{ template } = 'cloud/search.tt';
- $c->stash( last_clouds =>
- [ $c->model( 'DB::Search' )->search()->slice( 0, 2 ) ] );
+ $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->forward('intentioncloud::View::TT');
+ $c->session->{referer} = $c->stash->{template};
+ if (defined $c->session->{'lang'}){
+ $c->languages( [ $c->session->{'lang'} ]);
+ }
+ $c->forward( 'intentioncloud::View::TT' );
}
1;