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,7 +13,7 @@
<%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %>
</nav>
<% if (my $first_remark = @$remarks[0]) { =%>
<div class="remarks">
<div class="remarks">
<h3>Remarks</h3>
<% for my $remark (@$remarks) { =%>
<article class="remark">
@ -23,11 +23,11 @@
<p class="body"><%= %$remark{'body'} %></p>
</article>
<% } =%>
</div>
<nav>
</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>
</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>