Merge commit '0.3.1-RC3' into message-recipient
[Sone.git] / src / main / resources / templates / include / viewPost.html
index 8b4911d..ffc7608 100644 (file)
@@ -1,83 +1,65 @@
-<div id="<% post.id|html>" class="post <%if loop.last>last<%/if>">
-       <div>
-               <div class="author profile-link"><a href="viewSone.html?sone=<% post.sone.id|html>"><% post.sone.niceName|html></a></div>
-               <div class="text"><% post.text|html></div>
+<a name="post-<% post.id|html>"></a>
+<div id="<% post.id|html>" class="post<%if loop.last> last<%/if><%if post.new> new<%/if>">
+       <div class="post-time hidden"><% post.time|html></div>
+       <div class="avatar">
+               <img src="/WoT/GetIdenticon?identity=<% post.sone.id|html>&amp;width=48&height=48" width="48" height="48" alt="Avatar Image" />
        </div>
-       <div class="status-line">
-               <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
-               <div class="likes<%if post.likes.size|match value=0> hidden<%/if>"><span>⬆<span class="like-count"><% post.likes.size></span></span></div>
-               <%ifnull ! currentSone>
-                       <form class="like<%if post.liked> hidden<%/if>" action="like.html" method="post">
-                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
-                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
-                               <input type="hidden" name="type" value="post" />
-                               <input type="hidden" name="post" value="<% post.id|html>" />
-                               <button type="submit" value="1"><%= View.Post.LikeLink|l10n|html></button>
-                       </form>
-                       <form class="unlike<%if ! post.liked> hidden<%/if>" action="unlike.html" method="post">
-                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
-                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
-                               <input type="hidden" name="type" value="post" />
-                               <input type="hidden" name="post" value="<% post.id|html>" />
-                               <button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
-                       </form>
-               <%/if>
-               <%if post.sone.current>
-                       <form class="delete" action="deletePost.html" method="post">
-                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
-                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
-                               <input type="hidden" name="post" value="<% post.id|html>" />
-                               <button type="submit"><%= View.Post.DeleteLink|l10n|html></button>
-                       </form>
-               <%/if>
-       </div>
-       <div class="replies">
-               <%foreach post.replies reply>
-                       <div id="<% reply.id|html>" class="reply">
-                               <div>
-                                       <div class="author profile-link"><a href="viewSone.html?sone=<% reply.sone.id|html>"><% reply.sone.niceName|html></a></div>
-                                       <div class="text"><% reply.text|html></div>
-                               </div>
-                               <div class="status-line">
-                                       <div class="time"><% reply.time|date format="MMM d, yyyy, HH:mm:ss"></div>
-                                       <div class="likes<%if reply.likes.size|match value=0> hidden<%/if>"><span>⬆<span class="like-count"><% reply.likes.size></span></span></div>
-                                       <%ifnull ! currentSone>
-                                               <form class="like<%if reply.liked> hidden<%/if>" action="like.html" method="post">
-                                                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
-                                                       <input type="hidden" name="returnPage" value="<% request.uri|html>" />
-                                                       <input type="hidden" name="type" value="reply" />
-                                                       <input type="hidden" name="reply" value="<% reply.id|html>" />
-                                                       <button type="submit" value="1"><%= View.Post.LikeLink|l10n|html></button>
-                                               </form>
-                                               <form class="unlike<%if ! reply.liked> hidden<%/if>" action="unlike.html" method="post">
-                                                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
-                                                       <input type="hidden" name="returnPage" value="<% request.uri|html>" />
-                                                       <input type="hidden" name="type" value="reply" />
-                                                       <input type="hidden" name="reply" value="<% reply.id|html>" />
-                                                       <button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
-                                               </form>
-                                       <%/if>
-                                       <%if reply.sone.current>
-                                               <form class="delete" action="deleteReply.html" method="post">
-                                                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
-                                                       <input type="hidden" name="returnPage" value="<% request.uri|html>" />
-                                                       <input type="hidden" name="reply" value="<% reply.id|html>" />
-                                                       <button type="submit"><%= View.Post.Reply.DeleteLink|l10n|html></button>
-                                               </form>
-                                       <%/if>
-                               </div>
-                       </div>
-               <%/foreach>
-               <%ifnull ! currentSone>
-                       <div class="create-reply">
-                               <form method="post" action="createReply.html">
+       <div class="inner-part">
+               <div>
+                       <div class="author profile-link"><a href="viewSone.html?sone=<% post.sone.id|html>"><% post.sone.niceName|html></a></div>
+                       <%ifnull !post.recipient>
+                               <span class="recipient-to">→</span>
+                               <%ifnull post.recipient.identity>
+                                       <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><% View.Post.UnknownAuthor|l10n|html></a></div>
+                               <%else>
+                                       <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><% post.recipient.niceName|html></a></div>
+                               <%/if>
+                       <%/if>
+                       <div class="text"><% post.text|html></div>
+               </div>
+               <div class="post-status-line status-line">
+                       <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
+                       <div class="likes<%if post.likes.size|match value=0> hidden<%/if>"><span title="<% post.likes.soneNames|html>">⬆<span class="like-count"><% post.likes.size></span></span></div>
+                       <%ifnull ! currentSone>
+                               <form class="like like-post<%if post.liked> hidden<%/if>" action="like.html" method="post">
+                                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                                       <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                                       <input type="hidden" name="type" value="post" />
+                                       <input type="hidden" name="post" value="<% post.id|html>" />
+                                       <button type="submit" value="1"><%= View.Post.LikeLink|l10n|html></button>
+                               </form>
+                               <form class="unlike unlike-post<%if ! post.liked> hidden<%/if>" action="unlike.html" method="post">
+                                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                                       <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                                       <input type="hidden" name="type" value="post" />
+                                       <input type="hidden" name="post" value="<% post.id|html>" />
+                                       <button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
+                               </form>
+                       <%/if>
+                       <%if post.sone.current>
+                               <form class="delete delete-post" action="deletePost.html" method="post">
                                        <input type="hidden" name="formPassword" value="<% formPassword|html>" />
                                        <input type="hidden" name="returnPage" value="<% request.uri|html>" />
                                        <input type="hidden" name="post" value="<% post.id|html>" />
-                                       <input type="text" class="reply-input" name="text" value="" />
-                                       <button type="submit"><%= View.Post.SendReply|l10n|html></button>
+                                       <button type="submit"><%= View.Post.DeleteLink|l10n|html></button>
                                </form>
-                       </div>
-               <%/if>
+                       <%/if>
+               </div>
+               <div class="replies">
+                       <%foreach post.replies reply>
+                               <%include include/viewReply.html>
+                       <%/foreach>
+                       <%ifnull ! currentSone>
+                               <div class="create-reply">
+                                       <form method="post" action="createReply.html">
+                                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                                               <input type="hidden" name="post" value="<% post.id|html>" />
+                                               <input type="text" class="reply-input" name="text" value="" />
+                                               <button type="submit"><%= View.Post.SendReply|l10n|html></button>
+                                       </form>
+                               </div>
+                       <%/if>
+               </div>
        </div>
 </div>