summary refs log tree commit diff
path: root/lib/intentioncloud/Controller/Cloud.pm
blob: 49d42ebfa64870aa06179c4a8aca8b5f3be4e635 (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
package intentioncloud::Controller::Cloud;

use strict;
use warnings;
use parent 'Catalyst::Controller';

sub old_cloud : Regex('^(\d{4})/(\d{2})/(\d{2})/(\w+)/(.*$)') {
    my ( $self, $c ) = @_;
    $c->stash->{ template } = 'cloud/old_cloud.tt';

    my $cloud
        = $c->model( 'DB::Search' )->find( { permalink => $c->req->path } );
    if ( $cloud ) {
        $c->stash( cloud => $cloud );
    } else {
    }
}

sub search : Local {
    my ( $self, $c ) = @_;
    $c->stash->{ template } = 'cloud/cloud.tt';

    $c->model( 'Search' )->search( $c );
}

sub random : Local {
    my ( $self, $c ) = @_;
    $c->stash->{ template } = 'cloud/random.tt';

    $c->stash( cloud => $c->model( 'DB::Search' )
            ->find( {}, { order_by => [ 'rand()' ] } ) );
}

1;

=head1 NAME

intentioncloud::Controller::Cloud - Catalyst Controller

=head1 DESCRIPTION

Catalyst Controller.

=head1 METHODS


=head1 AUTHOR

franck cuny,,,

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.