diff --git a/PostText.pl b/PostText.pl index 8f0815f..bf68ada 100755 --- a/PostText.pl +++ b/PostText.pl @@ -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'); }; }; diff --git a/README.md b/README.md index 288bf15..2c2e185 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/templates/post_remark.html.ep b/templates/post_remark.html.ep index 44c2481..32c08ff 100644 --- a/templates/post_remark.html.ep +++ b/templates/post_remark.html.ep @@ -1,6 +1,17 @@ % layout 'main'; % title 'New Remark';

<%= title %>

+<% if (my $thread_body = %$thread{'body'}) { =%> +
+
+ #<%= %$thread{'id'} %> +

<%= %$thread{'title'} %>

+

<%= %$thread{'date'} %>

+
<%= %$thread{'author'} %>
+

<%= $thread_body %>

+
+
+<% } =%>
<%= label_for name => 'Author' %>