sub save {
my $self = shift;
my ( $title, $text, $id, $ver, $moderated ) =
( $self->param('title'),
$self->param('content'),
$self->param('node_id') || undef,
$self->param('node_version') || 0,
$self->param('moderated') || 0 );
$self->log->debug($self->param('content'));
# [2012/07/24 14:06:09] [DEBUG] 15703 Mojolicious.Plugin.RequestTimer - POST /admin/node/save (Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1).
# [2012/07/24 14:06:09] [DEBUG] 15703 Mojolicious.Routes - Routing to a callback.
# [2012/07/24 14:06:09] [DEBUG] 15703 Mojolicious.Routes - Routing to controller "MyApp::Admin" and action "save".
# Wide character in print at /home/nikita/perl5/lib/perl5/Log/Log4perl/Appender/File.pm line 245.
# Wide character in print at /home/nikita/perl5/lib/perl5/Log/Log4perl/Appender/Screen.pm line 39.
# [2012/07/24 14:06:09] [DEBUG] 15703 MyApp.Admin - 123123!!!11������������������
if ( my $node = $self->db->resultset('Node')->update_or_create
({ id => $id, name => $title }) ) {
my $updated_node = $node->update_node($text);
$self->log->debug ( Dumper $updated_node->get_columns );
defined($moderated) ?
$updated_node->data_all()->set_moderation(1) : undef ;
}
$self->redirect_to('/admin');
}