Add markdown to Controllers

This commit is contained in:
swagg boi 2025-04-04 19:41:26 -04:00
parent 8c69bf31c0
commit 58670e3244
2 changed files with 24 additions and 18 deletions

View File

@ -32,10 +32,11 @@ sub create($self) {
$v = $self->validation if $self->req->method eq 'POST';
if ($v && $v->has_data) {
$v->required('author' )->size(1, 63);
$v->required('body' )->size(2, $body_limit);
$v->optional('bump' );
$v->optional('preview');
$v->required('author' )->size(1, 63);
$v->required('body' )->size(2, $body_limit);
$v->optional('bump' );
$v->optional('preview' );
$v->optional('markdown');
$v->csrf_protect;
if ($v->has_error('csrf_token')) {
@ -48,10 +49,11 @@ sub create($self) {
$self->stash(status => 400)
}
else {
my $remark_author = $v->param('author' );
my $remark_body = $v->param('body' );
my $bump_thread = $v->param('bump' );
my $preview = $v->param('preview');
my $remark_author = $v->param('author' );
my $remark_body = $v->param('body' );
my $bump_thread = $v->param('bump' );
my $preview = $v->param('preview' );
my $markdown = $v->param('markdown');
$self->session(author => $remark_author);
@ -59,7 +61,8 @@ sub create($self) {
$self->remark->create(
$thread_id,
$remark_author,
$remark_body
$remark_body,
$markdown
);
$self->thread->bump($thread_id) if $bump_thread;

View File

@ -11,10 +11,11 @@ sub create($self) {
$v = $self->validation if $self->req->method eq 'POST';
if ($v && $v->has_data) {
$v->required('author' )->size(1, 63);
$v->required('title' )->size(1, 127);
$v->required('body' )->size(2, $body_limit);
$v->optional('preview');
$v->required('author' )->size(1, 63);
$v->required('title' )->size(1, 127);
$v->required('body' )->size(2, $body_limit);
$v->optional('preview' );
$v->optional('markdown');
$v->csrf_protect;
if ($v->has_error('csrf_token')) {
@ -27,10 +28,11 @@ sub create($self) {
$self->stash(status => 400)
}
else {
my $thread_author = $v->param('author' );
my $thread_title = $v->param('title' );
my $thread_body = $v->param('body' );
my $preview = $v->param('preview');
my $thread_author = $v->param('author' );
my $thread_title = $v->param('title' );
my $thread_body = $v->param('body' );
my $preview = $v->param('preview' );
my $markdown = $v->param('markdown');
$self->session(author => $thread_author);
@ -38,7 +40,8 @@ sub create($self) {
my $new_thread_id = $self->thread->create(
$thread_author,
$thread_title,
$thread_body
$thread_body,
$markdown_status
);
return $self->redirect_to(