From ce7ea8c75593036038c7a2481e39267aa7b98cac Mon Sep 17 00:00:00 2001 From: swaggboi Date: Fri, 4 Apr 2025 20:03:40 -0400 Subject: [PATCH] Add Markdown checkbox to thread->create; use defined-or to catch false --- lib/PostText/Controller/Thread.pm | 2 ++ lib/PostText/Model/Thread.pm | 2 +- templates/thread/create.html.ep | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/PostText/Controller/Thread.pm b/lib/PostText/Controller/Thread.pm index 2021a29..0c094d2 100644 --- a/lib/PostText/Controller/Thread.pm +++ b/lib/PostText/Controller/Thread.pm @@ -36,6 +36,8 @@ sub create($self) { $self->session(author => $thread_author); + print $self->dumper($v); + unless ($preview) { my $new_thread_id = $self->thread->create( $thread_author, diff --git a/lib/PostText/Model/Thread.pm b/lib/PostText/Model/Thread.pm index 9d05413..0805d4f 100644 --- a/lib/PostText/Model/Thread.pm +++ b/lib/PostText/Model/Thread.pm @@ -13,7 +13,7 @@ sub create( $author, $title, $body, - $markdown = 0, + $markdown //= 0, $hidden = 0, $flagged = 0 ) diff --git a/templates/thread/create.html.ep b/templates/thread/create.html.ep index c5c2547..74664de 100644 --- a/templates/thread/create.html.ep +++ b/templates/thread/create.html.ep @@ -57,6 +57,10 @@ rows => 6 ) %> +
+ <%= check_box markdown => 1, id => 'markdown' %> + <%= label_for markdown => 'Markdown' %> +
<%= check_box preview => 1, id => 'preview' %> <%= label_for preview => 'Preview' %>