Use url_for()->fragment() to make certain links jump to appropriate sections
This commit is contained in:
parent
7e05af4c4b
commit
0bea8118ba
|
@ -29,6 +29,11 @@ sub create($self) {
|
||||||
$self->stash(status => 400)
|
$self->stash(status => 400)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
my $thread_url = $self->url_for(single_thread => {
|
||||||
|
thread_id => $thread_id,
|
||||||
|
thread_page => $self->remark->last_page_for($thread_id)
|
||||||
|
})->fragment('remarks');
|
||||||
|
|
||||||
$self->remark->create(
|
$self->remark->create(
|
||||||
$thread_id,
|
$thread_id,
|
||||||
$remark_author,
|
$remark_author,
|
||||||
|
@ -39,10 +44,7 @@ sub create($self) {
|
||||||
|
|
||||||
$self->thread->bump($thread_id);
|
$self->thread->bump($thread_id);
|
||||||
|
|
||||||
return $self->redirect_to(single_thread => {
|
return $self->redirect_to($thread_url);
|
||||||
thread_id => $thread_id,
|
|
||||||
thread_page => $self->remark->last_page_for($thread_id)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}} %>
|
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}} %>
|
||||||
</nav>
|
</nav>
|
||||||
<% if (my $first_remark = $remarks->[0]) { =%>
|
<% if (my $first_remark = $remarks->[0]) { =%>
|
||||||
<div class="remarks">
|
<div class="remarks" id="remarks">
|
||||||
<h3>Remarks</h3>
|
<h3>Remarks</h3>
|
||||||
<% for my $remark (@{$remarks}) { =%>
|
<% for my $remark (@{$remarks}) { =%>
|
||||||
<article class="remark">
|
<article class="remark">
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
<p class="body"><%= truncate_text $thread->{'body'} %></p>
|
<p class="body"><%= truncate_text $thread->{'body'} %></p>
|
||||||
<nav class="remarks">
|
<nav class="remarks">
|
||||||
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}} %>
|
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}} %>
|
||||||
<%= link_to single_thread => {thread_id => $thread->{'id'}}, begin %>
|
<%= link_to url_for(single_thread => {thread_id => $thread->{'id'}})
|
||||||
|
->fragment('remarks'), begin %>
|
||||||
(<%= $thread->{'remark_count'} %> remarks)
|
(<%= $thread->{'remark_count'} %> remarks)
|
||||||
<% end %>
|
<% end %>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user