Rev | Line | |
---|
[30] | 1 | package Vote::Controller::Newpoll; |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | use base 'Catalyst::Controller'; |
---|
| 6 | |
---|
| 7 | =head1 NAME |
---|
| 8 | |
---|
| 9 | Vote::Controller::Newpoll - Catalyst Controller |
---|
| 10 | |
---|
| 11 | =head1 DESCRIPTION |
---|
| 12 | |
---|
| 13 | Catalyst Controller. |
---|
| 14 | |
---|
| 15 | =head1 METHODS |
---|
| 16 | |
---|
| 17 | =cut |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | =head2 index |
---|
| 21 | |
---|
| 22 | =cut |
---|
| 23 | |
---|
| 24 | sub index : Private { |
---|
| 25 | my ( $self, $c ) = @_; |
---|
| 26 | |
---|
| 27 | if ($c->req->param('mail')) { |
---|
| 28 | $c->model('Vote')->create_poll_request( |
---|
| 29 | mail => $c->req->param('mail'), |
---|
| 30 | url => $c->uri_for('/newpoll'), |
---|
| 31 | label => $c->req->param('label'), |
---|
| 32 | ); |
---|
[44] | 33 | $c->stash->{template} = 'newpoll/request.tt'; |
---|
[30] | 34 | } |
---|
| 35 | |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | sub default : LocalPath { |
---|
| 39 | my ( $self, $c, undef, $id ) = @_; |
---|
| 40 | |
---|
| 41 | $c->stash->{reqid} = $id; |
---|
| 42 | |
---|
| 43 | if ($c->req->param('passwd')) { |
---|
| 44 | my $pid = $c->model('Vote')->poll_from_request($id, $c->req->param('passwd')); |
---|
| 45 | $c->res->redirect($c->uri_for('/admin', $pid)); |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | =head1 AUTHOR |
---|
| 50 | |
---|
| 51 | Thauvin Olivier |
---|
| 52 | |
---|
| 53 | =head1 LICENSE |
---|
| 54 | |
---|
| 55 | This library is free software, you can redistribute it and/or modify |
---|
| 56 | it under the same terms as Perl itself. |
---|
| 57 | |
---|
| 58 | =cut |
---|
| 59 | |
---|
| 60 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.