A lil cleanup

This commit is contained in:
swaggboi 2022-08-24 00:21:18 -04:00
parent d9bbcf6bae
commit 4576163015
3 changed files with 22 additions and 24 deletions

View File

@ -121,7 +121,7 @@ group {
# Gotta be a better way to name this route...
return $c->redirect_to(
'thread_idremark_page',
'remark_page',
{thread_id => $thread_id}
);
}
@ -137,11 +137,10 @@ group {
# Thread
group {
under '/thread';
under '/thread/:thread_id', [thread_id => qr/[0-9]+/];
# This desperately needs clean-up
get '/:thread_id/:remark_page',
[thread_id => qr/[0-9]+/, remark_page => qr/[0-9]+/],
get '/:remark_page',
[remark_page => qr/[0-9]+/],
{remark_page => 1}, sub ($c) {
my $thread_id = $c->param('thread_id');
my $thread = $c->thread->get_thread_by_id($thread_id);

View File

@ -13,21 +13,21 @@
<%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %>
</nav>
<% if (my $first_remark = @$remarks[0]) { =%>
<div class="remarks">
<h3>Remarks</h3>
<% for my $remark (@$remarks) { =%>
<article class="remark">
<span class="id">#<%= %$remark{'id'} %></span>
<h4 class="date"><%= %$remark{'date'} %></h4>
<h5 class="author"><%= %$remark{'author'} %></h5>
<p class="body"><%= %$remark{'body'} %></p>
</article>
<% } =%>
</div>
<nav>
<%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %>
<% if ($last_page && $last_page != 1) { =%>
<%= pagination $this_page, $last_page, ($base_path . '/{page}') %>
<% } %>
</nav>
<div class="remarks">
<h3>Remarks</h3>
<% for my $remark (@$remarks) { =%>
<article class="remark">
<span class="id">#<%= %$remark{'id'} %></span>
<h4 class="date"><%= %$remark{'date'} %></h4>
<h5 class="author"><%= %$remark{'author'} %></h5>
<p class="body"><%= %$remark{'body'} %></p>
</article>
<% } =%>
</div>
<nav>
<%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %>
<% if ($last_page && $last_page != 1) { =%>
<%= pagination $this_page, $last_page, ($base_path . '/{page}') %>
<% } %>
</nav>
<% } =%>

View File

@ -5,8 +5,7 @@
<% for my $thread (@$threads) { =%>
<article class="thread">
<span class="id">
<%= link_to "#$thread->{'id'}",
thread_idremark_page => {thread_id => $thread->{'id'}} %>
<%= link_to "#$thread->{'id'}", remark_page => {thread_id => $thread->{'id'}} %>
</span>
<h3 class="title"><%= %$thread{'title'} %></h3>
<h4 class="date"><%= %$thread{'date'} %></h4>