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

@ -24,7 +24,7 @@ Run the tests locally (against development environment)
## TODOs ## 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. Grow into full blown Mojo?
1. More granular tests 1. More granular tests
1. Document post_text.conf (whoopsie) 1. Document post_text.conf (whoopsie)

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

@ -4,7 +4,11 @@
<form method="post"> <form method="post">
<div class="name field"> <div class="name field">
<%= label_for name => 'Author' %> <%= 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')) { =%> <% if (my $error = validation->error('name')) { =%>
<p class="field-with-error">Invalid name: 1 to 63 characters please.</p> <p class="field-with-error">Invalid name: 1 to 63 characters please.</p>
<% } =%> <% } =%>

@ -4,7 +4,11 @@
<form method="post"> <form method="post">
<div class="name field"> <div class="name field">
<%= label_for name => 'Author' %> <%= 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')) { =%> <% if (my $error = validation->error('name')) { =%>
<p class="field-with-error">Invalid name: 1 to 63 characters please.</p> <p class="field-with-error">Invalid name: 1 to 63 characters please.</p>
<% } =%> <% } =%>