Fixed remarks paging

This commit is contained in:
swagg boi 2022-08-22 23:09:48 -04:00
parent 3be6dae9f0
commit e0b7ab4a7d
4 changed files with 7 additions and 4 deletions

View file

@ -105,7 +105,8 @@ group {
my $base_path = $c->match->path_for(remark_page => undef)->{'path'};
my $this_page = $c->param('remark_page');
my $last_page = $c->remark->get_last_page_by_thread_id($thread_id);
my $remarks = $c->remark->get_remarks_by_thread_id($thread_id);
my $remarks =
$c->remark->get_remarks_by_thread_id($thread_id, $this_page);
if (my $thread_body = %$thread{'body'}) {
$c->stash(

View file

@ -24,11 +24,10 @@ Run the tests locally (against development environment)
## TODOs
1. Paging for remarks is broken because I conflated ascending and
descending... Need to come back to this I need sleep
1. Form to create new remarks
1. I'm kinda hardcoding the single-thread view `link_to` in the
templates because I cannot for the life of me figure out how to use
`url_for` to populate the `thread_id` placeholder. Probably need to
clean-up the HTML too, just used `<span>` cuz I didn't know what
else to use
1. Just clean stuff up in general lol

View file

@ -15,6 +15,7 @@
<div class="remarks">
<% 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>

View file

@ -4,7 +4,9 @@
<div class="threads">
<% for my $thread (@$threads) { =%>
<article class="thread">
<span><%= link_to '#' . %$thread{'id'}, '/thread/' . %$thread{'id'} %></span>
<span class="id">
<%= link_to '#' . %$thread{'id'}, '/thread/' . %$thread{'id'} %>
</span>
<h3 class="title"><%= %$thread{'title'} %></h3>
<h4 class="date"><%= %$thread{'date'} %></h4>
<h5 class="author"><%= %$thread{'author'} %></h5>