Create inclusion template for viewing a post.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 16 Oct 2010 10:27:32 +0000 (12:27 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 16 Oct 2010 10:27:32 +0000 (12:27 +0200)
src/main/resources/i18n/sone.en.properties
src/main/resources/templates/include/viewPost.html [new file with mode: 0644]
src/main/resources/templates/index.html
src/main/resources/templates/viewPost.html

index 2d3c1d3..179ab52 100644 (file)
@@ -107,3 +107,6 @@ Page.ViewPost.Button.PostReply=Post Reply!
 Page.FollowSone.Title=Follow Sone - Sone
 
 Page.Logout.Title=Logout - Sone
+
+View.Post.DeleteLink=Delete Post
+View.Post.SendReply=Post Reply!
diff --git a/src/main/resources/templates/include/viewPost.html b/src/main/resources/templates/include/viewPost.html
new file mode 100644 (file)
index 0000000..c6ea6a2
--- /dev/null
@@ -0,0 +1,21 @@
+<div class="post">
+       <div class="author"><a href="viewSone.html?sone=<% post.sone.id>"><% post.sone.niceName|html></a></div>
+       <div class="text"><% post.text|html></div>
+       <div class="time"><a href="viewPost.html?post=<% post.id>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
+       <%if post.sone.isCurrent><div class="delete"><a href="deletePost.html?post="><%= View.Post.DeleteLink|l10n|html></a></div>
+</div>
+<%foreach post.replies reply>
+       <div class="reply">
+               <div class="author"><a href="viewSone.html?sone=<% reply.sone.id>"><% reply.sone.niceName|html></a></div>
+               <div class="text"><% reply.text|html></div>
+               <div class="time"><% reply.time|date format="MMM d, yyyy, HH:mm:ss"></div>
+       </div>
+<%/foreach>
+<div class="create-reply">
+       <form method="post" action="createReply.html">
+               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+               <input type="hidden" name="post" value="<% post.id>" />
+               <input type="text" name="text" value="" />
+               <button type="submit"><%= View.Post.SendReply|l10n|html></button>
+       </form>
+</div>
index d148926..3db413d 100644 (file)
 
        <div id="posts">
                <%foreach posts post>
-                       <div class="post">
-                               <div class="author"><a href="viewSone.html?sone=<% post.sone.id>"><% post.sone.niceName|html></a></div>
-                               <div class="text"><% post.text|html></div>
-                               <div class="time"><a href="viewPost.html?post=<% post.id>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
-                       </div>
-                       <%foreach post.replies reply>
-                               <div class="reply">
-                                       <div class="author"><a href="viewSone.html?sone=<% reply.sone.id>"><% reply.sone.niceName|html></a></div>
-                                       <div class="text"><% reply.text|html></div>
-                                       <div class="time"><% reply.time|date format="MMM d, yyyy, HH:mm:ss"></div>
-                               </div>
-                       <%/foreach>
-                       <div class="create-reply">
-                               <form method="post" action="createReply.html">
-                                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
-                                       <input type="hidden" name="post" value="<% post.id>" />
-                                       <input type="text" name="text" value="" />
-                                       <button type="submit">Post Reply</button>
-                               </form>
-                       </div>
+                       <%include include/viewPost.html>
                <%foreachelse>
                        <div><%= Page.Index.PostList.Text.NoPostYet|l10n|html></div>
                <%/foreach>
index 237bfce..0209b20 100644 (file)
@@ -2,25 +2,6 @@
 
        <h1><%= Page.ViewPost.Page.Title|l10n|insert needle="{sone}" key=post.sone.niceName|html></h1>
 
-       <div class="post">
-               <div class="author"><a href="viewSone.html?sone=<% post.sone.id>"><% post.sone.niceName|html></a></div>
-               <div class="text"><% post.text|html></div>
-               <div class="time"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></div>
-       </div>
-       <%foreach post.replies reply>
-               <div class="reply">
-                       <div class="author"><a href="viewSone.html?sone=<% reply.sone.id>"><% reply.sone.niceName|html></a></div>
-                       <div class="text"><% reply.text|html></div>
-                       <div class="time"><% reply.time|date format="MMM d, yyyy, HH:mm:ss"></div>
-               </div>
-       <%/foreach>
-       <div class="create-reply">
-               <form method="post" action="createReply.html">
-                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
-                       <input type="hidden" name="post" value="<% post.id>" />
-                       <input type="text" name="text" value="" />
-                       <button type="submit"><%= Page.ViewPost.Button.PostReply|l10n|html></button>
-               </form>
-       </div>
+       <%include include/viewPost.html>
 
 </div>