Add like functionality to replies.
[Sone.git] / src / main / resources / templates / include / viewPost.html
1 <div id="<% post.id|html>" class="post <%if loop.last>last<%/if>">
2         <div>
3                 <div class="author profile-link"><a href="viewSone.html?sone=<% post.sone.id|html>"><% post.sone.niceName|html></a></div>
4                 <div class="text"><% post.text|html></div>
5         </div>
6         <div class="status-line">
7                 <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
8                 <div class="likes<%if post.likes.size|match value=0> hidden<%/if>"><span>⬆<span class="like-count"><% post.likes.size></span></span></div>
9                 <%ifnull ! currentSone>
10                         <form class="like<%if post.liked> hidden<%/if>" action="like.html" method="post">
11                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
12                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
13                                 <input type="hidden" name="type" value="post" />
14                                 <input type="hidden" name="post" value="<% post.id|html>" />
15                                 <button type="submit" value="1"><%= View.Post.LikeLink|l10n|html></button>
16                         </form>
17                         <form class="unlike<%if ! post.liked> hidden<%/if>" action="unlike.html" method="post">
18                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
19                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
20                                 <input type="hidden" name="type" value="post" />
21                                 <input type="hidden" name="post" value="<% post.id|html>" />
22                                 <button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
23                         </form>
24                 <%/if>
25                 <%if post.sone.current>
26                         <form class="delete" action="deletePost.html" method="post">
27                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
28                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
29                                 <input type="hidden" name="post" value="<% post.id|html>" />
30                                 <button type="submit"><%= View.Post.DeleteLink|l10n|html></button>
31                         </form>
32                 <%/if>
33         </div>
34         <div class="replies">
35                 <%foreach post.replies reply>
36                         <div id="<% reply.id|html>" class="reply">
37                                 <div>
38                                         <div class="author profile-link"><a href="viewSone.html?sone=<% reply.sone.id|html>"><% reply.sone.niceName|html></a></div>
39                                         <div class="text"><% reply.text|html></div>
40                                 </div>
41                                 <div class="status-line">
42                                         <div class="time"><% reply.time|date format="MMM d, yyyy, HH:mm:ss"></div>
43                                         <div class="likes<%if reply.likes.size|match value=0> hidden<%/if>"><span>⬆<span class="like-count"><% reply.likes.size></span></span></div>
44                                         <%ifnull ! currentSone>
45                                                 <form class="like<%if reply.liked> hidden<%/if>" action="like.html" method="post">
46                                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
47                                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
48                                                         <input type="hidden" name="type" value="reply" />
49                                                         <input type="hidden" name="reply" value="<% reply.id|html>" />
50                                                         <button type="submit" value="1"><%= View.Post.LikeLink|l10n|html></button>
51                                                 </form>
52                                                 <form class="unlike<%if ! reply.liked> hidden<%/if>" action="unlike.html" method="post">
53                                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
54                                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
55                                                         <input type="hidden" name="type" value="reply" />
56                                                         <input type="hidden" name="reply" value="<% reply.id|html>" />
57                                                         <button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
58                                                 </form>
59                                         <%/if>
60                                         <%if reply.sone.current>
61                                                 <form class="delete" action="deleteReply.html" method="post">
62                                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
63                                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
64                                                         <input type="hidden" name="reply" value="<% reply.id|html>" />
65                                                         <button type="submit"><%= View.Post.Reply.DeleteLink|l10n|html></button>
66                                                 </form>
67                                         <%/if>
68                                 </div>
69                         </div>
70                 <%/foreach>
71                 <%ifnull ! currentSone>
72                         <div class="create-reply">
73                                 <form method="post" action="createReply.html">
74                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
75                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
76                                         <input type="hidden" name="post" value="<% post.id|html>" />
77                                         <input type="text" class="reply-input" name="text" value="" />
78                                         <button type="submit"><%= View.Post.SendReply|l10n|html></button>
79                                 </form>
80                         </div>
81                 <%/if>
82         </div>
83 </div>