A lil cleanup
This commit is contained in:
parent
d9bbcf6bae
commit
4576163015
|
@ -121,7 +121,7 @@ group {
|
||||||
|
|
||||||
# Gotta be a better way to name this route...
|
# Gotta be a better way to name this route...
|
||||||
return $c->redirect_to(
|
return $c->redirect_to(
|
||||||
'thread_idremark_page',
|
'remark_page',
|
||||||
{thread_id => $thread_id}
|
{thread_id => $thread_id}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -137,11 +137,10 @@ group {
|
||||||
|
|
||||||
# Thread
|
# Thread
|
||||||
group {
|
group {
|
||||||
under '/thread';
|
under '/thread/:thread_id', [thread_id => qr/[0-9]+/];
|
||||||
|
|
||||||
# This desperately needs clean-up
|
get '/:remark_page',
|
||||||
get '/:thread_id/:remark_page',
|
[remark_page => qr/[0-9]+/],
|
||||||
[thread_id => qr/[0-9]+/, remark_page => qr/[0-9]+/],
|
|
||||||
{remark_page => 1}, sub ($c) {
|
{remark_page => 1}, sub ($c) {
|
||||||
my $thread_id = $c->param('thread_id');
|
my $thread_id = $c->param('thread_id');
|
||||||
my $thread = $c->thread->get_thread_by_id($thread_id);
|
my $thread = $c->thread->get_thread_by_id($thread_id);
|
||||||
|
|
|
@ -13,21 +13,21 @@
|
||||||
<%= 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">#<%= %$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>
|
||||||
<%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %>
|
<%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %>
|
||||||
<% if ($last_page && $last_page != 1) { =%>
|
<% if ($last_page && $last_page != 1) { =%>
|
||||||
<%= pagination $this_page, $last_page, ($base_path . '/{page}') %>
|
<%= pagination $this_page, $last_page, ($base_path . '/{page}') %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</nav>
|
</nav>
|
||||||
<% } =%>
|
<% } =%>
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
<% for my $thread (@$threads) { =%>
|
<% for my $thread (@$threads) { =%>
|
||||||
<article class="thread">
|
<article class="thread">
|
||||||
<span class="id">
|
<span class="id">
|
||||||
<%= link_to "#$thread->{'id'}",
|
<%= link_to "#$thread->{'id'}", remark_page => {thread_id => $thread->{'id'}} %>
|
||||||
thread_idremark_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>
|
||||||
|
|
Loading…
Reference in a new issue