Browse Source

* render html comments

master
Alex 'AdUser' Z 7 years ago
parent
commit
876037c029
  1. 3
      lib/CMTD/Main.pm
  2. 14
      templates/main/list.html.ep

3
lib/CMTD/Main.pm

@ -47,7 +47,8 @@ sub c_list {
# TODO: processing
@cm = @tm;
}
$self->render(json => \@cm);
$self->stash(comments => \@cm);
$self->respond_to(json => {json => \@cm}, any => {template => 'main/list'});
} else {
$self->client_reply(400, "no such site");
} 1;

14
templates/main/list.html.ep

@ -0,0 +1,14 @@
% my $comments = stash('comments') || [];
<div id="cmtd_main">
% foreach my $cm (@{ $comments }) {
<div id="cmtd_comment">
<div class="cmtd_head">
<%= tag span => (class => 'cmtd_num') => $cm->{seq} %>,
<%= tag span => (class => 'cmtd_name') => $cm->{name} %>,
<%= tag span => (class => 'cmtd_date') => $cm->{date} %>,
<%= link_to 'Reply' => '#', class => 'reply', 'date-id' => $cm->{seq} %>
</div>
<%= tag 'div' => (class => 'cmtd_text') => $cm->{text} %>
</div>
% }
</div>
Loading…
Cancel
Save