Store original and parsed text in contenxt, compare to hide “toggle” link.
[Sone.git] / src / main / resources / templates / include / viewPost.html
1 <div id="<% post.id|html>" class="post<%if loop.last> last<%/if><%if post.new> new<%/if>">
2         <a name="post-<% post.id|html>"></a>
3         <div class="post-time hidden"><% post.time|html></div>
4         <div class="post-author hidden"><% post.sone.id|html></div>
5         <div class="avatar">
6                 <img src="/WebOfTrust/GetIdenticon?identity=<% post.sone.id|html>&amp;width=48&height=48" width="48" height="48" alt="Avatar Image" />
7         </div>
8         <div class="inner-part">
9                 <div>
10                         <div class="author profile-link"><a href="viewSone.html?sone=<% post.sone.id|html>"><% post.sone.niceName|html></a></div>
11                         <%ifnull !post.recipient>
12                                 <span class="recipient-to">→</span>
13                                 <%ifnull post.recipient.identity>
14                                         <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><%= View.Post.UnknownAuthor|l10n|html></a></div>
15                                 <%else>
16                                         <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><% post.recipient.niceName|html></a></div>
17                                 <%/if>
18                         <%/if>
19                         <% post.text|html|store key=originalText text=true>
20                         <% post.text|parse sone=post.sone|store key=parsedText text=true>
21                         <div class="post-text raw-text<%if !raw> hidden<%/if>"><% originalText></div>
22                         <div class="post-text text<%if raw> hidden<%/if>"><% parsedText></div>
23                 </div>
24                 <div class="post-status-line status-line">
25                         <div class="bookmarks">
26                                 <form class="unbookmark<%if !post.bookmarked> hidden<%/if>" action="unbookmark.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" title="<%= View.Post.Bookmarks.PostIsBookmarked|l10n|html>">★</button>
31                                 </form>
32                                 <form class="bookmark<%if post.bookmarked> hidden<%/if>" action="bookmark.html" method="post">
33                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
34                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
35                                         <input type="hidden" name="post" value="<% post.id|html>" />
36                                         <button type="submit" title="<%= View.Post.Bookmarks.PostIsNotBookmarked|l10n|html>">☆</button>
37                                 </form>
38                         </div>
39                         <span class='separator'>·</span>
40                         <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
41                         <%if ! originalText|match key=parsedText>
42                                 <span class='separator'>·</span>
43                                 <div class="show-source"><a href="viewPost.html?post=<% post.id|html>&amp;raw=<%if raw>false<%else>true<%/if>"><%= View.Post.ShowSource|l10n|html></a></div>
44                         <%/if>
45                         <div class="likes<%if post.likes.size|match value=0> hidden<%/if>">
46                                 <span class='separator'>·</span>
47                                 <span title="<% post.likes.soneNames|html>">↑<span class="like-count"><% post.likes.size></span></span>
48                         </div>
49                         <%ifnull ! currentSone>
50                                 <span class='separator'>·</span>
51                                 <form class="like like-post<%if post.liked> hidden<%/if>" action="like.html" method="post">
52                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
53                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
54                                         <input type="hidden" name="type" value="post" />
55                                         <input type="hidden" name="post" value="<% post.id|html>" />
56                                         <button type="submit" value="1"><%= View.Post.LikeLink|l10n|html></button>
57                                 </form>
58                                 <form class="unlike unlike-post<%if ! post.liked> hidden<%/if>" action="unlike.html" method="post">
59                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
60                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
61                                         <input type="hidden" name="type" value="post" />
62                                         <input type="hidden" name="post" value="<% post.id|html>" />
63                                         <button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
64                                 </form>
65                                 <%if !post.sone.current>
66                                         <span class='separator'>·</span>
67                                         <form class="trust post-trust<%if post.sone.trust.assigned> hidden<%/if>" action="trust.html" method="post">
68                                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
69                                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
70                                                 <input type="hidden" name="sone" value="<% post.sone.id|html>" />
71                                                 <button type="submit" title="<%= View.Trust.Tooltip.Trust|l10n|html>">✓</button>
72                                         </form>
73                                         <form class="distrust post-distrust<%if post.sone.trust.assigned> hidden<%/if>" action="distrust.html" method="post">
74                                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
75                                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
76                                                 <input type="hidden" name="sone" value="<% post.sone.id|html>" />
77                                                 <button type="submit" title="<%= View.Trust.Tooltip.Distrust|l10n|html>">✗</button>
78                                         </form>
79                                         <form class="untrust post-untrust<%if !post.sone.trust.assigned> hidden<%/if>" action="untrust.html" method="post">
80                                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
81                                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
82                                                 <input type="hidden" name="sone" value="<% post.sone.id|html>" />
83                                                 <button type="submit" title="<%= View.Trust.Tooltip.Untrust|l10n|html>">↶</button>
84                                         </form>
85                                 <%/if>
86                         <%/if>
87                         <%if post.sone.local>
88                                 <span class='separator'>·</span>
89                                 <form class="delete delete-post" action="deletePost.html" method="post">
90                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
91                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
92                                         <input type="hidden" name="post" value="<% post.id|html>" />
93                                         <button type="submit"><%= View.Post.DeleteLink|l10n|html></button>
94                                 </form>
95                         <%/if>
96                 </div>
97                 <div class="replies">
98                         <%foreach post.replies reply>
99                                 <%include include/viewReply.html>
100                         <%/foreach>
101                         <%ifnull ! currentSone>
102                                 <div class="create-reply">
103                                         <form method="post" action="createReply.html">
104                                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
105                                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
106                                                 <input type="hidden" name="post" value="<% post.id|html>" />
107                                                 <div class="sender">
108                                                         <select name="sender" title="<%= View.UpdateStatus.Text.ChooseSenderIdentity|l10n|html>">
109                                                                 <%foreach localSones localSone|sort>
110                                                                         <option value="<% localSone.id|html>"<%if localSone.current> selected="selected"<%/if>><% localSone.niceName|html></option>
111                                                                 <%/foreach>
112                                                         </select>
113                                                 </div>
114                                                 <div class="select-sender"><button type="button" title="<%= View.UpdateStatus.Text.ChooseSenderIdentity|l10n|html>">+</button></div>
115                                                 <input type="text" class="reply-input" name="text" value="" />
116                                                 <button type="submit"><%= View.Post.SendReply|l10n|html></button>
117                                         </form>
118                                 </div>
119                         <%/if>
120                 </div>
121         </div>
122 </div>