Return last remark with Remark form
This commit is contained in:
parent
0e315c296b
commit
2054de053e
|
@ -129,8 +129,12 @@ group {
|
|||
}
|
||||
|
||||
my $thread = $c->thread->get_thread_by_id($thread_id);
|
||||
my $last_remark = $c->remark->last_remark($thread_id);
|
||||
|
||||
$c->stash(thread => $thread);
|
||||
$c->stash(
|
||||
thread => $thread,
|
||||
last_remark => $last_remark
|
||||
);
|
||||
|
||||
return $c->render();
|
||||
};
|
||||
|
|
|
@ -24,9 +24,9 @@ Run the tests locally (against development environment)
|
|||
|
||||
## TODOs
|
||||
|
||||
1. Return the last remark with remark form
|
||||
1. Method names may need to be shortened, should use POD instead to
|
||||
describe their function
|
||||
1. Single remark view
|
||||
|
||||
## Crazy future ideas
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
<% for my $thread (@$threads) { =%>
|
||||
<article class="thread">
|
||||
<span class="id">
|
||||
<%= link_to "#$thread->{'id'}", remark_page => {thread_id => $thread->{'id'}} %>
|
||||
<%= link_to "#$thread->{'id'}",
|
||||
remark_page => {thread_id => $thread->{'id'}} %>
|
||||
</span>
|
||||
<h3 class="title"><%= %$thread{'title'} %></h3>
|
||||
<h4 class="date"><%= %$thread{'date'} %></h4>
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
% layout 'main';
|
||||
% title 'New Remark';
|
||||
<h2><%= title %></h2>
|
||||
<div class="threads">
|
||||
<article class="thread">
|
||||
<span class="id">
|
||||
<%= link_to "#$thread->{'id'}", remark_page => {thread_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' %>
|
||||
|
@ -34,3 +23,27 @@
|
|||
</div>
|
||||
<%= submit_button 'Post', class => 'post button' %>
|
||||
</form>
|
||||
<div class="threads">
|
||||
<h3>Thread</h3>
|
||||
<article class="thread">
|
||||
<span class="id">
|
||||
<%= link_to "#$thread->{'id'}",
|
||||
remark_page => {thread_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>
|
||||
<% if (my $last_remark_id = $last_remark->{'id'}) { =%>
|
||||
<div class="remarks">
|
||||
<h3>Last Remark</h3>
|
||||
<article class="remark">
|
||||
<span class="id">#<%= $last_remark_id %></span>
|
||||
<h4 class="date"><%= $last_remark->{'date'} %></h4>
|
||||
<h5 class="author"><%= $last_remark->{'author'} %></h5>
|
||||
<p class="body"><%= $last_remark->{'body'} %></p>
|
||||
</article>
|
||||
</div>
|
||||
<% } =%>
|
||||
|
|
Loading…
Reference in New Issue
Block a user