Mercurial > genshi > mirror
comparison examples/tutorial/geddit/templates/info.html @ 720:acf7c5ee36e7 experimental-newctxt
newctxt branch: Merged revisions [678:835] via svnmerge from [source:trunk].
author | cmlenz |
---|---|
date | Fri, 11 Apr 2008 08:42:11 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
567:837786a584d5 | 720:acf7c5ee36e7 |
---|---|
1 <!DOCTYPE html> | |
2 <html xmlns="http://www.w3.org/1999/xhtml" | |
3 xmlns:xi="http://www.w3.org/2001/XInclude" | |
4 xmlns:py="http://genshi.edgewall.org/"> | |
5 <xi:include href="layout.html" /> | |
6 <head> | |
7 <title>${link.title}</title> | |
8 <link rel="alternate" type="application/atom+xml" title="Geddit: ${link.title}" | |
9 href="${url('/feed/%s/' % link.id)}" /> | |
10 <script type="text/javascript"> | |
11 function loadCommentForm(a) { | |
12 $.get("${url('/comment/%s/' % link.id)}", {}, function(html) { | |
13 var form = a.hide().parent().after(html).next(); | |
14 function closeForm() { | |
15 form.slideUp("fast", function() { a.fadeIn(); form.remove() }); | |
16 return false; | |
17 } | |
18 function initForm() { | |
19 form.find("input[@name='cancel']").click(closeForm); | |
20 form.submit(function() { | |
21 var data = form.find("input[@type='text'], textarea").serialize(); | |
22 $.post("${url('/comment/%s/' % link.id)}", data, function(html) { | |
23 var elem = $(html).get(0); | |
24 if (/form/i.test(elem.tagName)) { | |
25 form.after(elem).remove(); | |
26 form = $(elem); | |
27 initForm(); | |
28 } else { | |
29 if ($("ul.comments").length == 0) { | |
30 a.parent().before('<ul class="comments"></ul>'); | |
31 } | |
32 $("ul.comments").append($(elem)); | |
33 closeForm(); | |
34 } | |
35 }); | |
36 return false; | |
37 }); | |
38 } | |
39 initForm(); | |
40 }); | |
41 } | |
42 $(document).ready(function() { | |
43 $("a.action").click(function() { | |
44 loadCommentForm($(this)); | |
45 return false; | |
46 }); | |
47 }); | |
48 </script> | |
49 </head> | |
50 <body class="info"> | |
51 <h1>${link.title}</h1> | |
52 <a href="${link.url}">${link.url}</a><br /> | |
53 posted by ${link.username} at ${link.time.strftime('%x %X')}<br /> | |
54 | |
55 <ul py:if="link.comments" class="comments"> | |
56 <xi:include href="_comment.html" | |
57 py:for="num, comment in enumerate(link.comments)" /> | |
58 </ul> | |
59 | |
60 <p><a class="action" href="${url('/comment/%s/' % link.id)}">Add comment</a></p> | |
61 </body> | |
62 </html> |