Hide reply creation input text fields until “comment” link is clicked.
[Sone.git] / src / main / resources / templates / index.html
1 <%include include/head.html>
2
3         <script language="javascript">
4                 /* register input field/textarea swap. */
5                 $(document).ready(function() {
6                         registerInputTextareaSwap("#sone input.createpost", "What are you doing?");
7                         registerInputTextareaSwap("#sone input.create-reply", "Write a Reply…");
8
9                         /* hide all the “create reply” forms until a link is clicked. */
10                         $("#sone .post").each(function() {
11                                 postId = $(this).attr("id");
12                                 (function(postId) {
13                                         commentElement = $("<div>Comment</div>").addClass("show-reply-form").click(function() {
14                                                 $("#sone .post#" + postId + " .create-reply").removeClass("hidden");
15                                         });
16                                 })(postId);
17                                 $(this).find(".create-reply").addClass("hidden");
18                                 $(this).find(".status-line .time").after(commentElement);
19                         });
20                 });
21         </script>
22
23         <h1><%= Page.Index.Page.Title|l10n|insert needle="{sone}" key=currentSone.name|html></h1>
24
25         <div>
26                 <form action="createPost.html" method="post">
27                         <div>
28                                 <label for="text"><%= Page.Index.Label.Text|l10n|html></label>
29                                 <input class="createpost" name="text" />
30                         </div>
31                         <div>
32                                 <button type="submit"><%= Page.Index.Button.Post|l10n|html></button>
33                         </div>
34                 </form>
35         </div>
36
37         <h1><%= Page.Index.PostList.Title|l10n|html></h1>
38
39         <div id="posts">
40                 <%foreach posts post>
41                         <%include include/viewPost.html>
42                 <%foreachelse>
43                         <div><%= Page.Index.PostList.Text.NoPostYet|l10n|html></div>
44                 <%/foreach>
45         </div>
46         
47         <h1><%= Page.Index.AddSone.Title|l10n|html></h1>
48         
49         <div><%= Page.Index.AddSone.Description|l10n|html></div>
50
51         <form action="addSone.html" method="post">
52                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
53                 <input id="addsone" type="text" name="request-uri" />
54                 <button type="submit"><%= Page.Index.AddSone.Button.Add|l10n|html></button>
55         </form>
56
57 <%include include/tail.html>