From 8fb64fde64ae5d4147ec8cd69156cf74a2810891 Mon Sep 17 00:00:00 2001 From: swag Date: Sun, 4 Jun 2023 12:55:53 -0400 Subject: [PATCH] Option to remark without bumping --- README.md | 1 - lib/PostText/Controller/Remark.pm | 6 ++++-- templates/remark/create.html.ep | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index daf1513..7b6b92b 100644 --- a/README.md +++ b/README.md @@ -73,4 +73,3 @@ Run the tests locally (against development environment): requested](https://docs.mojolicious.org/Mojolicious/Plugin/DefaultHelpers#respond_to) (JSON?) 1. Post thread via SMS (twil.io??) -1. Option to remark without bumping? diff --git a/lib/PostText/Controller/Remark.pm b/lib/PostText/Controller/Remark.pm index 453ad98..06c96d6 100644 --- a/lib/PostText/Controller/Remark.pm +++ b/lib/PostText/Controller/Remark.pm @@ -20,10 +20,11 @@ sub create($self) { $v = $self->validation if $self->req->method eq 'POST'; if ($v && $v->has_data) { - my ($remark_author, $remark_body); + my ($remark_author, $remark_body, $bump_thread); $v->required('author')->size(1, 63); $v->required('body' )->size(2, 4000); + $v->optional('bump' ); if ($v->has_error) { $self->stash(status => 400) @@ -31,6 +32,7 @@ sub create($self) { else { $remark_author = $v->param('author'); $remark_body = $v->param('body' ); + $bump_thread = $v->param('bump' ); $self->remark->create( $thread_id, @@ -40,7 +42,7 @@ sub create($self) { $self->session(author => $remark_author); - $self->thread->bump($thread_id); + $self->thread->bump($thread_id) if $bump_thread; return $self->redirect_to($self->url_for(single_thread => { thread_id => $thread_id, diff --git a/templates/remark/create.html.ep b/templates/remark/create.html.ep index 96c7d89..7bdf527 100644 --- a/templates/remark/create.html.ep +++ b/templates/remark/create.html.ep @@ -31,6 +31,10 @@ autofocus => undef ) %> +
+ <%= label_for bump => 'Bump' %> + <%= check_box bump => 1, id => 'bump', checked => undef %> +