Show the parent thread in the remark form
This commit is contained in:
parent
2c3faa9f2e
commit
ed31fb963c
|
@ -97,12 +97,12 @@ group {
|
|||
};
|
||||
|
||||
any [qw{GET POST}], '/:thread_id', [thread_id => qr/[0-9]+/], sub ($c) {
|
||||
my $v;
|
||||
my ($thread_id, $v) = ($c->param('thread_id'), undef);
|
||||
|
||||
$v = $c->validation() if $c->req->method eq 'POST';
|
||||
|
||||
if ($v && $v->has_data) {
|
||||
my $thread_id = $c->param('thread_id');
|
||||
|
||||
my $remark_name = $c->param('name');
|
||||
my $remark_body = $c->param('post');
|
||||
|
||||
|
@ -127,6 +127,10 @@ group {
|
|||
}
|
||||
}
|
||||
|
||||
my $thread = $c->thread->get_thread_by_id($thread_id);
|
||||
|
||||
$c->stash(thread => $thread);
|
||||
|
||||
return $c->render(template => 'post_remark');
|
||||
};
|
||||
};
|
||||
|
|
|
@ -25,7 +25,6 @@ Run the tests locally (against development environment)
|
|||
## TODOs
|
||||
|
||||
1. Hyperlink to remarks form
|
||||
1. In remark form, show the parent thread and maybe the last reply too
|
||||
1. Is there something I can do about route names?
|
||||
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
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
% layout 'main';
|
||||
% title 'New Remark';
|
||||
<h2><%= title %></h2>
|
||||
<% if (my $thread_body = %$thread{'body'}) { =%>
|
||||
<div class="threads">
|
||||
<article class="thread">
|
||||
<span class="id">#<%= %$thread{'id'} %></span>
|
||||
<h3 class="title"><%= %$thread{'title'} %></h3>
|
||||
<h4 class="date"><%= %$thread{'date'} %></h4>
|
||||
<h5 class="author"><%= %$thread{'author'} %></h5>
|
||||
<p class="body"><%= $thread_body %></p>
|
||||
</article>
|
||||
</div>
|
||||
<% } =%>
|
||||
<form method="post">
|
||||
<div class="name field">
|
||||
<%= label_for name => 'Author' %>
|
||||
|
|
Loading…
Reference in a new issue