Option to remark without bumping

This commit is contained in:
swag 2023-06-04 12:55:53 -04:00
parent f6c390fc9b
commit 8fb64fde64
3 changed files with 8 additions and 3 deletions

View File

@ -73,4 +73,3 @@ Run the tests locally (against development environment):
requested](https://docs.mojolicious.org/Mojolicious/Plugin/DefaultHelpers#respond_to) requested](https://docs.mojolicious.org/Mojolicious/Plugin/DefaultHelpers#respond_to)
(JSON?) (JSON?)
1. Post thread via SMS (twil.io??) 1. Post thread via SMS (twil.io??)
1. Option to remark without bumping?

View File

@ -20,10 +20,11 @@ sub create($self) {
$v = $self->validation if $self->req->method eq 'POST'; $v = $self->validation if $self->req->method eq 'POST';
if ($v && $v->has_data) { 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('author')->size(1, 63);
$v->required('body' )->size(2, 4000); $v->required('body' )->size(2, 4000);
$v->optional('bump' );
if ($v->has_error) { if ($v->has_error) {
$self->stash(status => 400) $self->stash(status => 400)
@ -31,6 +32,7 @@ sub create($self) {
else { else {
$remark_author = $v->param('author'); $remark_author = $v->param('author');
$remark_body = $v->param('body' ); $remark_body = $v->param('body' );
$bump_thread = $v->param('bump' );
$self->remark->create( $self->remark->create(
$thread_id, $thread_id,
@ -40,7 +42,7 @@ sub create($self) {
$self->session(author => $remark_author); $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 => { return $self->redirect_to($self->url_for(single_thread => {
thread_id => $thread_id, thread_id => $thread_id,

View File

@ -31,6 +31,10 @@
autofocus => undef autofocus => undef
) %> ) %>
</div> </div>
<div class="form-field">
<%= label_for bump => 'Bump' %>
<%= check_box bump => 1, id => 'bump', checked => undef %>
</div>
<button type="submit" class="form-button">Post</button> <button type="submit" class="form-button">Post</button>
</form> </form>
<section class="pager"> <section class="pager">