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

@ -36,6 +36,7 @@ sub create($self) {
$v->required('body' )->size(2, $body_limit); $v->required('body' )->size(2, $body_limit);
$v->optional('bump' ); $v->optional('bump' );
$v->optional('preview' ); $v->optional('preview' );
$v->optional('markdown');
$v->csrf_protect; $v->csrf_protect;
if ($v->has_error('csrf_token')) { if ($v->has_error('csrf_token')) {
@ -52,6 +53,7 @@ sub create($self) {
my $remark_body = $v->param('body' ); my $remark_body = $v->param('body' );
my $bump_thread = $v->param('bump' ); my $bump_thread = $v->param('bump' );
my $preview = $v->param('preview' ); my $preview = $v->param('preview' );
my $markdown = $v->param('markdown');
$self->session(author => $remark_author); $self->session(author => $remark_author);
@ -59,7 +61,8 @@ sub create($self) {
$self->remark->create( $self->remark->create(
$thread_id, $thread_id,
$remark_author, $remark_author,
$remark_body $remark_body,
$markdown
); );
$self->thread->bump($thread_id) if $bump_thread; $self->thread->bump($thread_id) if $bump_thread;

View File

@ -15,6 +15,7 @@ sub create($self) {
$v->required('title' )->size(1, 127); $v->required('title' )->size(1, 127);
$v->required('body' )->size(2, $body_limit); $v->required('body' )->size(2, $body_limit);
$v->optional('preview' ); $v->optional('preview' );
$v->optional('markdown');
$v->csrf_protect; $v->csrf_protect;
if ($v->has_error('csrf_token')) { if ($v->has_error('csrf_token')) {
@ -31,6 +32,7 @@ sub create($self) {
my $thread_title = $v->param('title' ); my $thread_title = $v->param('title' );
my $thread_body = $v->param('body' ); my $thread_body = $v->param('body' );
my $preview = $v->param('preview' ); my $preview = $v->param('preview' );
my $markdown = $v->param('markdown');
$self->session(author => $thread_author); $self->session(author => $thread_author);
@ -38,7 +40,8 @@ sub create($self) {
my $new_thread_id = $self->thread->create( my $new_thread_id = $self->thread->create(
$thread_author, $thread_author,
$thread_title, $thread_title,
$thread_body $thread_body,
$markdown_status
); );
return $self->redirect_to( return $self->redirect_to(