Implement name persistence instead of anything actually on my TODOs

This commit is contained in:
swag 2022-09-16 21:46:56 -04:00
parent 01d2ca1eaf
commit 5435678de8
4 changed files with 15 additions and 3 deletions

View File

@ -24,7 +24,7 @@ Run the tests locally (against development environment)
## TODOs
1. I think I should revist the Post and Remark routes...
1. Should replace all reference to 'name' to 'author', getting confused
1. Grow into full blown Mojo?
1. More granular tests
1. Document post_text.conf (whoopsie)

View File

@ -94,6 +94,8 @@ sub startup($self) {
$thread_body
);
$c->session(author => $thread_author);
return $c->redirect_to('list');
}
}
@ -123,6 +125,8 @@ sub startup($self) {
$remark_body
);
$c->session(author => $remark_name);
return $c->redirect_to(
'thread_page',
{thread_id => $thread_id}

View File

@ -4,7 +4,11 @@
<form method="post">
<div class="name field">
<%= label_for name => 'Author' %>
<%= text_field name =>'Anonymous', maxlength => 63, minlength => 1 %>
<% if (my $previous_name = session->{'author'}) { %>
<%= text_field name => $previous_name, maxlength => 63, minlength => 1 %>
<% } else { %>
<%= text_field name => 'Anonymous', maxlength => 63, minlength => 1 %>
<% } %>
<% if (my $error = validation->error('name')) { =%>
<p class="field-with-error">Invalid name: 1 to 63 characters please.</p>
<% } =%>

View File

@ -4,7 +4,11 @@
<form method="post">
<div class="name field">
<%= label_for name => 'Author' %>
<%= text_field name =>'Anonymous', maxlength => 63, minlength => 1 %>
<% if (my $previous_name = session->{'author'}) { %>
<%= text_field name => $previous_name, maxlength => 63, minlength => 1 %>
<% } else { %>
<%= text_field name => 'Anonymous', maxlength => 63, minlength => 1 %>
<% } %>
<% if (my $error = validation->error('name')) { =%>
<p class="field-with-error">Invalid name: 1 to 63 characters please.</p>
<% } =%>