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