Show custom avatar where applicable.
[Sone.git] / src / main / resources / templates / include / viewPost.html
1 <div id="post-<% post.id|html>" class="post<%if loop.last> last<%/if><%if !post.sone.local><%if post.new> new<%/if><%/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="post-author-local hidden"><% post.sone.local></div>
6         <%include include/soneMenu.html class=="sone-post-menu" sone=post.sone>
7         <div class="avatar post-avatar" >
8                 <%if post.loaded>
9                         <%ifnull !post.sone.avatar>
10                                 <%post.sone.avatar|image-link max-width=48 max-height=48 mode=enlarge title="Avatar Image">
11                         <%else>
12                                 <img src="/WebOfTrust/GetIdenticon?identity=<% post.sone.id|html>&amp;width=48&height=48" width="48" height="48" alt="Avatar Image" />
13                         <%/if>
14                 <%else>
15                         <img src="images/sone-avatar.png" width="48" height="48" alt="Avatar Image" />
16                 <%/if>
17         </div>
18         <div class="inner-part">
19                 <div<%if !post.loaded> class="hidden"<%/if>>
20                         <div class="author profile-link"><a href="viewSone.html?sone=<% post.sone.id|html>"><% post.sone.niceName|html></a></div>
21                         <%ifnull !post.recipient>
22                                 <span class="recipient-to">→</span>
23                                 <%ifnull post.recipient.identity>
24                                         <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><%= View.Post.UnknownAuthor|l10n|html></a></div>
25                                 <%else>
26                                         <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><% post.recipient.niceName|html></a></div>
27                                 <%/if>
28                         <%/if>
29                         <% post.text|html|store key=originalText text=true>
30                         <% post.text|parse sone=post.sone|store key=parsedText text=true>
31                         <% post.text|parse sone=post.sone length=core.preferences.charactersPerPost cut-off-length=core.preferences.postCutOffLength|store key=shortText text=true>
32                         <div class="post-text raw-text<%if !raw> hidden<%/if>"><% originalText></div>
33                         <div class="post-text text<%if raw> hidden<%/if><%if !shortText|match key=parsedText> hidden<%/if>"><% parsedText></div>
34                         <div class="post-text short-text<%if raw> hidden<%/if><%if shortText|match key=parsedText> hidden<%/if>"><% shortText></div>
35                         <%if !shortText|match key=parsedText><%if !raw><a class="expand-post-text" href="viewPost.html?post=<% post.id|html>&amp;raw=true"><%= View.Post.ShowMore|l10n|html></a><%/if><%/if>
36                         <%if !shortText|match key=parsedText><%if !raw><a class="shrink-post-text hidden"><%= View.Post.ShowLess|l10n|html></a><%/if><%/if>
37                 </div>
38                 <div class="post-status-line status-line<%if !post.loaded> hidden<%/if>">
39                         <div class="bookmarks">
40                                 <form class="unbookmark<%if !post.bookmarked> hidden<%/if>" action="unbookmark.html" method="post">
41                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
42                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
43                                         <input type="hidden" name="post" value="<% post.id|html>" />
44                                         <button type="submit" title="<%= View.Post.Bookmarks.PostIsBookmarked|l10n|html>">★</button>
45                                 </form>
46                                 <form class="bookmark<%if post.bookmarked> hidden<%/if>" action="bookmark.html" method="post">
47                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
48                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
49                                         <input type="hidden" name="post" value="<% post.id|html>" />
50                                         <button type="submit" title="<%= View.Post.Bookmarks.PostIsNotBookmarked|l10n|html>">☆</button>
51                                 </form>
52                         </div>
53                         <span class='separator'>·</span>
54                         <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
55                         <span class='separator'>·</span>
56                         <div class="permalink permalink-post"><a href="post://<%post.id|html>">[<%= View.Post.Permalink|l10n|html>]</a></div>
57                         <span class='separator'>·</span>
58                         <div class="permalink permalink-author"><a href="sone://<%post.sone.id|html>">[<%= View.Post.PermalinkAuthor|l10n|html>]</a></div>
59                         <%if ! originalText|match key=parsedText>
60                                 <span class='separator'>·</span>
61                                 <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>
62                         <%/if>
63                         <div class="likes<%if post.likes.size|match value=0> hidden<%/if>">
64                                 <span class='separator'>·</span>
65                                 <span title="<% post.likes.soneNames|html>">↑<span class="like-count"><% post.likes.size></span></span>
66                         </div>
67                         <%ifnull ! currentSone>
68                                 <span class='separator'>·</span>
69                                 <form class="like like-post<%if post.liked> hidden<%/if>" action="like.html" method="post">
70                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
71                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
72                                         <input type="hidden" name="type" value="post" />
73                                         <input type="hidden" name="post" value="<% post.id|html>" />
74                                         <button type="submit" value="1"><%= View.Post.LikeLink|l10n|html></button>
75                                 </form>
76                                 <form class="unlike unlike-post<%if ! post.liked> hidden<%/if>" action="unlike.html" method="post">
77                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
78                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
79                                         <input type="hidden" name="type" value="post" />
80                                         <input type="hidden" name="post" value="<% post.id|html>" />
81                                         <button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
82                                 </form>
83                                 <%if !post.sone.current>
84                                         <span class='separator'>·</span>
85                                         <form class="trust post-trust<%if post.sone.trust.assigned> hidden<%/if>" action="trust.html" method="post">
86                                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
87                                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
88                                                 <input type="hidden" name="sone" value="<% post.sone.id|html>" />
89                                                 <button type="submit" title="<%= View.Trust.Tooltip.Trust|l10n|html>">✓</button>
90                                         </form>
91                                         <form class="distrust post-distrust<%if post.sone.trust.assigned> hidden<%/if>" action="distrust.html" method="post">
92                                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
93                                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
94                                                 <input type="hidden" name="sone" value="<% post.sone.id|html>" />
95                                                 <button type="submit" title="<%= View.Trust.Tooltip.Distrust|l10n|html>">✗</button>
96                                         </form>
97                                         <form class="untrust post-untrust<%if !post.sone.trust.assigned> hidden<%/if>" action="untrust.html" method="post">
98                                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
99                                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
100                                                 <input type="hidden" name="sone" value="<% post.sone.id|html>" />
101                                                 <button type="submit" title="<%= View.Trust.Tooltip.Untrust|l10n|html>">↶</button>
102                                         </form>
103                                 <%/if>
104                         <%/if>
105                         <%if post.sone.local>
106                                 <span class='separator'>·</span>
107                                 <form class="delete delete-post" action="deletePost.html" method="post">
108                                         <input type="hidden" name="formPassword" value="<% formPassword|html>" />
109                                         <input type="hidden" name="returnPage" value="<% request.uri|html>" />
110                                         <input type="hidden" name="post" value="<% post.id|html>" />
111                                         <button type="submit"><%= View.Post.DeleteLink|l10n|html></button>
112                                 </form>
113                         <%/if>
114                 </div>
115                 <div<%if post.loaded> class="hidden"<%/if>>
116                         <%= View.Post.NotDownloaded|l10n|html>
117                 </div>
118                 <div class="replies">
119                         <%foreach post.replies reply>
120                                 <%include include/viewReply.html>
121                         <%/foreach>
122                         <%ifnull ! currentSone>
123                                 <div class="create-reply">
124                                         <form method="post" action="createReply.html">
125                                                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
126                                                 <input type="hidden" name="returnPage" value="<% request.uri|html>" />
127                                                 <input type="hidden" name="post" value="<% post.id|html>" />
128                                                 <div class="sender">
129                                                         <select name="sender" title="<%= View.UpdateStatus.Text.ChooseSenderIdentity|l10n|html>">
130                                                                 <%foreach localSones localSone|sort>
131                                                                         <option value="<% localSone.id|html>"<%if localSone.current> selected="selected"<%/if>><% localSone.niceName|html></option>
132                                                                 <%/foreach>
133                                                         </select>
134                                                 </div>
135                                                 <div class="select-sender"><button type="button" title="<%= View.UpdateStatus.Text.ChooseSenderIdentity|l10n|html>">+</button></div>
136                                                 <input type="text" class="reply-input" name="text" value="" />
137                                                 <button type="submit"><%= View.Post.SendReply|l10n|html></button>
138                                         </form>
139                                 </div>
140                         <%/if>
141                 </div>
142         </div>
143 </div>