Changeset 66 in bookmarks
- Timestamp:
- 02/04/14 15:21:17 (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Bookmark.pm
r46 r66 2 2 3 3 use Moose; 4 use HTTP::Date qw{time2isoz}; 4 5 5 6 has id => ( is => 'ro' ); … … 15 16 has tags => ( is => 'rw' ); 16 17 has bookmark_uri => ( is => 'rw' ); 18 has exists => ( is => 'ro' ); 19 20 sub created { scalar localtime $_[0]->ctime } 21 sub updated { scalar localtime $_[0]->mtime } 22 sub created_iso { (my $iso = time2isoz($_[0]->ctime)) =~ s/\D//g; return $iso; } 23 sub updated_iso { (my $iso = time2isoz($_[0]->ctime)) =~ s/\D//g; return $iso; } 17 24 18 25 sub BUILD { -
trunk/BookmarkController.pm
r64 r66 119 119 $template->process( 120 120 'bookmark.tt', 121 { 122 uri => $self->request->param('uri'), 123 title => $self->request->param('title') || '', 121 { 122 bookmark => { 123 uri => $self->request->param('uri'), 124 title => $self->request->param('title') || '', 125 }, 124 126 }, 125 127 \my $output, … … 337 339 } else { 338 340 # display the bookmark form for this bookmark 339 # TODO: these should probably be methods on the Bookmark class340 $bookmark->{exists} = 1;341 $bookmark->{created} = localtime($bookmark->ctime);342 $bookmark->{updated} = localtime($bookmark->mtime);343 ($bookmark->{created_iso} = time2isoz($bookmark->ctime)) =~ s/\D//g;344 ($bookmark->{updated_iso} = time2isoz($bookmark->mtime)) =~ s/\D//g;345 341 my $template = Template->new; 346 342 $template->process( 347 343 'bookmark.tt', 348 $bookmark,344 { bookmark => $bookmark }, 349 345 \my $output, 350 346 ); -
trunk/Bookmarks.pm
r57 r66 63 63 return Bookmark->new({ 64 64 %$bookmark, 65 exists => 1, 65 66 tags => [ $self->get_tags({ uri => $bookmark->{uri} }) ], 66 67 base_uri => $self->base_uri, -
trunk/bookmark.tt
r64 r66 1 1 <html> 2 2 <head> 3 <title>Bookmark: [% title oruri %]</title>3 <title>Bookmark: [% bookmark.title or bookmark.uri %]</title> 4 4 <style type="text/css"> 5 5 body, th, td { … … 21 21 <div> 22 22 <h1> 23 [% UNLESS exists %]23 [% UNLESS bookmark.exists %] 24 24 <strong>New bookmark:</strong> 25 25 [% END %] 26 <a href="[% uri | html %]" target="_blank">[% title oruri %]</a>26 <a href="[% bookmark.uri | html %]" target="_blank">[% bookmark.title or bookmark.uri %]</a> 27 27 </h1> 28 [% IF exists %]28 [% IF bookmark.exists %] 29 29 <p class="timestamps"> 30 Bookmark created <a href="http://web.archive.org/web/[% created_iso %]/[% uri %]" title="Nearest Wayback Machine Link" target="_blank">[% created %]</a>[% IF mtime !=ctime %]; updated31 <a href="http://web.archive.org/web/[% updated_iso %]/[% uri %]" title="Nearest Wayback Machine Link" target="_blank">[%updated %]</a>[% END %]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 %] 32 32 </p> 33 [% IF tags.size %]33 [% IF bookmark.tags.size %] 34 34 <p class="tags">Tagged as: 35 [% FOREACH tag IN tags %]35 [% FOREACH tag IN bookmark.tags %] 36 36 <a href=".?tag=[% tag %]" class="tag" target="_blank" onclick="if (opener && !opener.closed) { opener.location = this.href; return false; }">[% tag %]</a> 37 37 [% END %] … … 44 44 <th>URI:</th> 45 45 <td> 46 <input type="text" name="uri" value="[% uri | html %]" size="80"/>46 <input type="text" name="uri" value="[% bookmark.uri | html %]" size="80"/> 47 47 </td> 48 48 </tr> … … 50 50 <th>Title:</th> 51 51 <td> 52 <input type="text" name="title" value="[% title | html %]" size="80"/>52 <input type="text" name="title" value="[% bookmark.title | html %]" size="80"/> 53 53 </td> 54 54 </tr> … … 56 56 <th>Tags:</th> 57 57 <td> 58 <input type="text" name="tags" value="[% tags.join(' ') | html %]" size="80"/>58 <input type="text" name="tags" value="[% bookmark.tags.join(' ') | html %]" size="80"/> 59 59 </td> 60 60 </tr>
Note: See TracChangeset
for help on using the changeset viewer.