source: bookmarks/trunk/bookmark.tt @ 78

Last change on this file since 78 was 66, checked in by peter, 11 years ago
  • the bookmark.tt template takes a hash or object named bookmark as its only variable
  • moved the calculation of a human-readable timestamp and the ISO timestamps for the WayBack machine from the BookmarkController class into the Bookmark class as methods (created, updated, created_iso, and updated_iso
  • moved the exists flag into the Bookmark class as an attribute
File size: 2.3 KB
RevLine 
[2]1<html>
2  <head>
[66]3    <title>Bookmark: [% bookmark.title or bookmark.uri %]</title>
[2]4    <style type="text/css">
5body, th, td {
6    font-size: .875em;
7}
[64]8h1 {
9  font-size: 1.25em;
10}
[2]11li {
12    margin-bottom: .5em;
13}
14th {
15    text-align: right;
16    font-weight: normal;
17}
18    </style>
19  </head>
20  <body>
21    <div>
[64]22      <h1>
[66]23      [% UNLESS bookmark.exists %]
[2]24        <strong>New bookmark:</strong>
25      [% END %]
[66]26      <a href="[% bookmark.uri | html %]" target="_blank">[% bookmark.title or bookmark.uri %]</a>
[64]27      </h1>
[66]28      [% IF bookmark.exists %]
[64]29        <p class="timestamps">
[66]30          Bookmark created <a href="http://web.archive.org/web/[% bookmark.created_iso %]/[% bookmark.uri %]" title="Nearest Wayback Machine Link" target="_blank">[% bookmark.created %]</a>[% IF bookmark.mtime != bookmark.ctime %]; updated
31          <a href="http://web.archive.org/web/[% bookmark.updated_iso %]/[% bookmark.uri %]" title="Nearest Wayback Machine Link" target="_blank">[% bookmark.updated %]</a>[% END %]
[64]32        </p>
[66]33        [% IF bookmark.tags.size %]
[3]34          <p class="tags">Tagged as:
[66]35            [% FOREACH tag IN bookmark.tags %]
[3]36              <a href=".?tag=[% tag %]" class="tag" target="_blank" onclick="if (opener && !opener.closed) { opener.location = this.href; return false; }">[% tag %]</a>
[2]37            [% END %]
38          </p>
39        [% END %]
40      [% END %]
41      <form method="post" action="">
42        <table>
43          <tr>
44            <th>URI:</th>
45            <td>
[66]46              <input type="text" name="uri" value="[% bookmark.uri | html %]" size="80"/>
[2]47            </td>
48          </tr>
49          <tr>
50            <th>Title:</th>
51            <td>
[66]52              <input type="text" name="title" value="[% bookmark.title | html %]" size="80"/>
[2]53            </td>
54          </tr>
55          <tr>
56            <th>Tags:</th>
57            <td>
[66]58              <input type="text" name="tags" value="[% bookmark.tags.join(' ') | html %]" size="80"/>
[2]59            </td>
60          </tr>
61          <tr>
62            <th></th>
63            <td>
64              <input type="submit" value="Save"/>
65            </td>
66          </tr>
67        </table>
68      </form>
69    </div>
70    <script>
71window.onload = function() {
72    if (document.location.hash == '#updated') {
[3]73        if (opener) {
74            opener.location.reload();
75        }
[2]76    }
77};
78    </script>
79  </body>
80</html>
81
82<!--
83vim:syntax=html
84-->
Note: See TracBrowser for help on using the repository browser.