Created
September 17, 2010 18:14
-
-
Save amiri/584666 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub update : Chained('object') PathPart('update') Args(0) { | |
my ( $self, $c ) = @_; | |
my $media_dir = '/deployment/' . $c->config->{'Locales'}->{$c->stash->{lang}} . '/' . $c->config->{$c->stash->{episode}->images->result_source->source_name}->{deploy_dir} if $c->stash->{episode}; | |
$c->stash( media_dir => $media_dir ) if $media_dir; | |
my $form = EpisodeForm->new(media_directory => dir($media_dir)); | |
my $item = $c->stash->{episode}; | |
if (lc $c->req->method eq 'post') { | |
$c->stash(episode => $item, form => $form ); | |
$c->req->params->{'file'} = $c->req->upload('file'); | |
$c->req->params->{'thumbnail'} = $c->req->upload('thumbnail'); | |
$c->stash(template => 'cms/episode/create_update.tt2'); | |
$form->process( | |
ctx => $c, | |
item => $item, | |
schema => $c->stash->{schema}, | |
params => $c->req->params, | |
); | |
$c->stash( fillinform => $form->fif); | |
$c->log->debug(Dwarn $form->errors); | |
return unless $form->validated; | |
$c->flash( status_msg => 'Episode edited' ); | |
return $c->res->redirect( | |
$c->uri_for( | |
$c->controller('CMS::Episode')->action_for('display'), [ $c->stash->{episode}->id])); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment