Skip to content

Commit b7e170a

Browse files
committed
Commenting in new template
1 parent 2ce90ca commit b7e170a

2 files changed

Lines changed: 67 additions & 42 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!-- Begin simple/blog/_comment.tx -->
2+
<div class="card my-4">
3+
<div class="card-body">
4+
<div class="">
5+
<a href="#">u/[% $comment.author.username %]</a>
6+
<small><span title="[% $comment.created_at %]">[% $comment.time_ago %]</span></small>
7+
</div>
8+
<div class="pt-4">
9+
%% $comment.content
10+
</div>
11+
<br />
12+
<a class="card-link" data-bs-toggle="collapse" href="#replyForm[% $comment.id %]" role="button" aria-expanded="false" aria-controls="replyForm[% $comment.id %]">[Reply]</a>
13+
<a href="#" class="card-link">[Permlink]</a>
14+
<div id="replyForm[% $comment.id %]" class="row mx-2 my-4 collapse">
15+
<form method="POST" action="[% $c.url_for( 'do_blog_comment' ) %]">
16+
<input type="hidden" name="parent_id" value="[% $comment.id %]" />
17+
<input type="hidden" name="blog_id" value="[% $blog.id %]" />
18+
<div class="mb-3">
19+
<label for="message" class="form-label">Post a Reply</label>
20+
<textarea class="form-control" name="message" id="message" rows="3"></textarea>
21+
</div>
22+
23+
<button type="submit" class="btn btn-primary float-end">Post Message</button>
24+
</form>
25+
</div>
26+
</div>
27+
%% for $comment.get_children -> $child_comment {
28+
<div style="margin-left: 2em">
29+
%% include "/default/blog/_comment.tx" { comment => $child_comment };
30+
</div>
31+
%% }
32+
</div>
33+
<!-- End simple/blog/_comment.tx -->

Web/templates/simple/blog/item.html.tx

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,47 +28,39 @@
2828

2929

3030

31-
<!-- Comments section-->
32-
<section class="mb-5">
33-
<div class="card bg-light">
34-
<div class="card-body">
35-
<!-- Comment form-->
36-
<form class="mb-4"><textarea class="form-control" rows="3" placeholder="Join the discussion and leave a comment!"></textarea></form>
37-
<!-- Comment with nested comments-->
38-
<div class="d-flex mb-4">
39-
<!-- Parent comment-->
40-
<div class="flex-shrink-0"><img class="rounded-circle" src="https://dummyimage.com/50x50/ced4da/6c757d.jpg" alt="..." /></div>
41-
<div class="ms-3">
42-
<div class="fw-bold">Commenter Name</div>
43-
If you're going to lead a space frontier, it has to be government; it'll never be private enterprise. Because the space frontier is dangerous, and it's expensive, and it has unquantified risks.
44-
<!-- Child comment 1-->
45-
<div class="d-flex mt-4">
46-
<div class="flex-shrink-0"><img class="rounded-circle" src="https://dummyimage.com/50x50/ced4da/6c757d.jpg" alt="..." /></div>
47-
<div class="ms-3">
48-
<div class="fw-bold">Commenter Name</div>
49-
And under those conditions, you cannot establish a capital-market evaluation of that enterprise. You can't get investors.
50-
</div>
51-
</div>
52-
<!-- Child comment 2-->
53-
<div class="d-flex mt-4">
54-
<div class="flex-shrink-0"><img class="rounded-circle" src="https://dummyimage.com/50x50/ced4da/6c757d.jpg" alt="..." /></div>
55-
<div class="ms-3">
56-
<div class="fw-bold">Commenter Name</div>
57-
When you put money directly to a problem, it makes a good headline.
58-
</div>
59-
</div>
60-
</div>
61-
</div>
62-
<!-- Single comment-->
63-
<div class="d-flex">
64-
<div class="flex-shrink-0"><img class="rounded-circle" src="https://dummyimage.com/50x50/ced4da/6c757d.jpg" alt="..." /></div>
65-
<div class="ms-3">
66-
<div class="fw-bold">Commenter Name</div>
67-
When I look at the universe and all the ways the universe wants to kill us, I find it hard to reconcile that with statements of beneficence.
68-
</div>
69-
</div>
70-
</div>
71-
</div>
72-
</section>
31+
<!-- Start Comments / Review section-->
32+
<section class="mb-5">
33+
<div class="card bg-light">
34+
<div class="card-body">
35+
<!-- Begin Review / Root Comment Form-->
36+
<div class="row">
37+
<form method="post" action="[% $c.url_for( 'do_blog_comment' ) %]">
38+
<input type="hidden" name="blog_id" value="[% $blog.id %]">
39+
40+
<textarea class="form-control" id="message" name="message" rows="4" placeholder="What do you think of [% $blog.title %]?">[% $form_message %]</textarea>
41+
42+
<div class="form-check form-switch">
43+
<input class="form-check-input" type="checkbox" value="1" name="rev_pos" id="rev_pos" [% $form_rev_pos ? " checked " : "" %]>
44+
<label class="form-check-label" for="rev_pos">This is a positive review. I recommend this blog.</label>
45+
</div>
46+
47+
<div class="form-check form-switch">
48+
<input class="form-check-input" type="checkbox" value="1" name="rev_neg" id="rev_neg" [% $form_rev_neg ? " checked " : "" %]>
49+
<label class="form-check-label" for="rev_neg">This is a negative review. I dislike this blog.</label>
50+
</div>
51+
52+
<button type="submit" class="btn btn-primary float-end">Post Review</button>
53+
</form>
54+
</div>
55+
<!-- End Review / Root Comment Form-->
56+
<div class="row">
57+
%% for $blog.get_comments -> $comment {
58+
%% include "/simple/blog/_comment.tx" { comment => $comment };
59+
%% }
60+
</div>
61+
</div>
62+
</div>
63+
</section>
64+
<!-- End Comments / Review section-->
7365

7466
%% }

0 commit comments

Comments
 (0)