annotate examples/tutorial/geddit/templates/info.html @ 967:19ac5d8fd96c trunk

Fix a number of tests which Python's new hash randomization is causing to fail randomly.
author hodgestar
date Sat, 29 Dec 2012 19:14:10 +0000
parents f779e566884d
children
rev   line source
611
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
1 <!DOCTYPE html>
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
2 <html xmlns="http://www.w3.org/1999/xhtml"
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
3 xmlns:xi="http://www.w3.org/2001/XInclude"
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
4 xmlns:py="http://genshi.edgewall.org/">
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
5 <xi:include href="layout.html" />
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
6 <head>
619
756e7418e10c GenshiTutorial: various updates to sync with wiki page.
cmlenz
parents: 618
diff changeset
7 <title>${link.title}</title>
628
9822dfff0fd5 GenshiTutorial: tweaks to sync with code on wiki page.
cmlenz
parents: 625
diff changeset
8 <link rel="alternate" type="application/atom+xml" title="Geddit: ${link.title}"
9822dfff0fd5 GenshiTutorial: tweaks to sync with code on wiki page.
cmlenz
parents: 625
diff changeset
9 href="${url('/feed/%s/' % link.id)}" />
625
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
10 <script type="text/javascript">
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
11 function loadCommentForm(a) {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
12 $.get("${url('/comment/%s/' % link.id)}", {}, function(html) {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
13 var form = a.hide().parent().after(html).next();
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
14 function closeForm() {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
15 form.slideUp("fast", function() { a.fadeIn(); form.remove() });
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
16 return false;
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
17 }
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
18 function initForm() {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
19 form.find("input[@name='cancel']").click(closeForm);
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
20 form.submit(function() {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
21 var data = form.find("input[@type='text'], textarea").serialize();
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
22 $.post("${url('/comment/%s/' % link.id)}", data, function(html) {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
23 var elem = $(html).get(0);
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
24 if (/form/i.test(elem.tagName)) {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
25 form.after(elem).remove();
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
26 form = $(elem);
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
27 initForm();
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
28 } else {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
29 if ($("ul.comments").length == 0) {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
30 a.parent().before('<ul class="comments"></ul>');
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
31 }
628
9822dfff0fd5 GenshiTutorial: tweaks to sync with code on wiki page.
cmlenz
parents: 625
diff changeset
32 $("ul.comments").append($(elem));
625
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
33 closeForm();
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
34 }
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
35 });
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
36 return false;
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
37 });
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
38 }
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
39 initForm();
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
40 });
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
41 }
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
42 $(document).ready(function() {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
43 $("a.action").click(function() {
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
44 loadCommentForm($(this));
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
45 return false;
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
46 });
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
47 });
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
48 </script>
611
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
49 </head>
633
f779e566884d GenshiTutorial: add body class to show that the ''@*'' XPath in the match template works.
cmlenz
parents: 628
diff changeset
50 <body class="info">
619
756e7418e10c GenshiTutorial: various updates to sync with wiki page.
cmlenz
parents: 618
diff changeset
51 <h1>${link.title}</h1>
756e7418e10c GenshiTutorial: various updates to sync with wiki page.
cmlenz
parents: 618
diff changeset
52 <a href="${link.url}">${link.url}</a><br />
621
734fbb77b579 Use system default date/time format in templates.
cmlenz
parents: 619
diff changeset
53 posted by ${link.username} at ${link.time.strftime('%x %X')}<br />
622
6780f1b1b20d GenshiTutorial: add Atom feeds.
cmlenz
parents: 621
diff changeset
54
619
756e7418e10c GenshiTutorial: various updates to sync with wiki page.
cmlenz
parents: 618
diff changeset
55 <ul py:if="link.comments" class="comments">
625
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
56 <xi:include href="_comment.html"
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
57 py:for="num, comment in enumerate(link.comments)" />
618
b6706f9346ac Simplify the tutorial project: comments are now flat, not hierarchical.
cmlenz
parents: 615
diff changeset
58 </ul>
625
abad7c2ebe15 GenshiTutorial: implemented AJAX commenting.
cmlenz
parents: 622
diff changeset
59
628
9822dfff0fd5 GenshiTutorial: tweaks to sync with code on wiki page.
cmlenz
parents: 625
diff changeset
60 <p><a class="action" href="${url('/comment/%s/' % link.id)}">Add comment</a></p>
611
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
61 </body>
236c351928a2 Add current code for GenshiTutorial to the `examples` directory.
cmlenz
parents:
diff changeset
62 </html>
Copyright (C) 2012-2017 Edgewall Software