Some clean-up

This commit is contained in:
swagg boi 2022-09-20 21:16:42 -04:00
parent e69ca992c0
commit bb47eb82a4
7 changed files with 29 additions and 25 deletions

View file

@ -70,7 +70,7 @@ $t->post_ok('/post/1')->status_is(200)
->text_like(h2 => qr/New Remark/); ->text_like(h2 => qr/New Remark/);
$t->post_ok('/post/1', form => \%valid_remark)->status_is(200) $t->post_ok('/post/1', form => \%valid_remark)->status_is(200)
->text_like(h2 => qr/Thread - #1/); ->text_like(h2 => qr/Thread #1/);
$t->post_ok('/post/1', form => \%invalid_remark)->status_is(400) $t->post_ok('/post/1', form => \%invalid_remark)->status_is(400)
->text_like(h2 => qr/New Remark/); ->text_like(h2 => qr/New Remark/);

View file

@ -9,6 +9,6 @@ use Test::Mojo;
my $script = curfile->dirname->sibling('PostText.pl'); my $script = curfile->dirname->sibling('PostText.pl');
my $t = Test::Mojo->new($script); my $t = Test::Mojo->new($script);
$t->get_ok('/remark/1')->status_is(200)->text_like(h2 => qr/Remark - #1/); $t->get_ok('/remark/1')->status_is(200)->text_like(h2 => qr/Remark #1/);
done_testing(); done_testing();

View file

@ -9,6 +9,6 @@ use Test::Mojo;
my $script = curfile->dirname->sibling('PostText.pl'); my $script = curfile->dirname->sibling('PostText.pl');
my $t = Test::Mojo->new($script); my $t = Test::Mojo->new($script);
$t->get_ok('/thread/1')->status_is(200)->text_like(h2 => qr/Thread - #1/); $t->get_ok('/thread/1')->status_is(200)->text_like(h2 => qr/Thread #1/);
done_testing(); done_testing();

View file

@ -5,15 +5,19 @@
<% for my $thread (@{$threads}) { =%> <% for my $thread (@{$threads}) { =%>
<article class="thread"> <article class="thread">
<span class="id"> <span class="id">
<%= link_to "Thread #$thread->{'id'}", <%= link_to "#$thread->{'id'}",
thread_page => {thread_id => $thread->{'id'}} %> thread_page => {thread_id => $thread->{'id'}} %>
</span> </span>
<h3 class="title"><%= $thread->{'title'} %></h3> <h3 class="title"><%= $thread->{'title'} %></h3>
<h4 class="date"><%= $thread->{'date'} %></h4> <h4 class="date"><%= $thread->{'date'} %></h4>
<h5 class="author"><%= $thread->{'author'} %></h5> <h5 class="author"><%= $thread->{'author'} %></h5>
<p class="body"><%= $thread->{'body'} %></p> <p class="body"><%= $thread->{'body'} %></p>
<span class="remarks">
<%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %> <%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %>
<footer><%= $thread->{'remark_count'} %> remarks</footer> <%= link_to thread_page => {thread_id => $thread->{'id'}}, begin %>
(<%= $thread->{'remark_count'} %> remarks)
<% end %>
</span>
</article> </article>
<% } =%> <% } =%>
</div> </div>

View file

@ -1,12 +1,12 @@
% layout 'main'; % layout 'main';
% title "Remark - #$remark->{'id'}"; % title "Remark #$remark->{'id'}";
<h2><%= title %></h2> <h2><%= title %></h2>
<div class="remarks"> <div class="remarks">
<article class="remark"> <article class="remark">
<span class="id">#<%= %$remark{'id'} %></span> <span class="id">#<%= $remark->{'id'} %></span>
<h4 class="date"><%= %$remark{'date'} %></h4> <h4 class="date"><%= $remark->{'date'} %></h4>
<h5 class="author"><%= %$remark{'author'} %></h5> <h5 class="author"><%= $remark->{'author'} %></h5>
<p class="body"><%= %$remark{'body'} %></p> <p class="body"><%= $remark->{'body'} %></p>
</article> </article>
</div> </div>
<nav> <nav>

View file

@ -34,10 +34,10 @@
<%= link_to "#$thread->{'id'}", <%= link_to "#$thread->{'id'}",
thread_page => {thread_id => $thread->{'id'}} %> thread_page => {thread_id => $thread->{'id'}} %>
</span> </span>
<h3 class="title"><%= %$thread{'title'} %></h3> <h3 class="title"><%= $thread->{'title'} %></h3>
<h4 class="date"><%= %$thread{'date'} %></h4> <h4 class="date"><%= $thread->{'date'} %></h4>
<h5 class="author"><%= %$thread{'author'} %></h5> <h5 class="author"><%= $thread->{'author'} %></h5>
<p class="body"><%= %$thread{'body'} %></p> <p class="body"><%= $thread->{'body'} %></p>
</article> </article>
</div> </div>
<% if (my $last_remark_id = $last_remark->{'id'}) { =%> <% if (my $last_remark_id = $last_remark->{'id'}) { =%>

View file

@ -1,29 +1,29 @@
% layout 'main'; % layout 'main';
% title "Thread - #$thread->{'id'}"; % title "Thread #$thread->{'id'}";
<h2><%= title %></h2> <h2><%= title %></h2>
<div class="threads"> <div class="threads">
<article class="thread"> <article class="thread">
<h3 class="title"><%= %$thread{'title'} %></h3> <h3 class="title"><%= $thread->{'title'} %></h3>
<h4 class="date"><%= %$thread{'date'} %></h4> <h4 class="date"><%= $thread->{'date'} %></h4>
<h5 class="author"><%= %$thread{'author'} %></h5> <h5 class="author"><%= $thread->{'author'} %></h5>
<p class="body"><%= %$thread{'body'} %></p> <p class="body"><%= $thread->{'body'} %></p>
</article> </article>
</div> </div>
<nav> <nav>
<%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %> <%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %>
</nav> </nav>
<% if (my $first_remark = @$remarks[0]) { =%> <% if (my $first_remark = $remarks->[0]) { =%>
<div class="remarks"> <div class="remarks">
<h3>Remarks</h3> <h3>Remarks</h3>
<% for my $remark (@$remarks) { =%> <% for my $remark (@{$remarks}) { =%>
<article class="remark"> <article class="remark">
<span class="id"> <span class="id">
<%= link_to "#$remark->{'id'}", <%= link_to "#$remark->{'id'}",
remark_id => {remark_id => $remark->{'id'}} %> remark_id => {remark_id => $remark->{'id'}} %>
</span> </span>
<h4 class="date"><%= %$remark{'date'} %></h4> <h4 class="date"><%= $remark->{'date'} %></h4>
<h5 class="author"><%= %$remark{'author'} %></h5> <h5 class="author"><%= $remark->{'author'} %></h5>
<p class="body"><%= %$remark{'body'} %></p> <p class="body"><%= $remark->{'body'} %></p>
</article> </article>
<% } =%> <% } =%>
</div> </div>