Changeset 66 in bookmarks for trunk/BookmarkController.pm


Ignore:
Timestamp:
02/04/14 15:21:17 (10 years ago)
Author:
peter
Message:
  • 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:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BookmarkController.pm

    r64 r66  
    119119        $template->process( 
    120120            '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                }, 
    124126            }, 
    125127            \my $output, 
     
    337339        } else { 
    338340            # display the bookmark form for this bookmark 
    339             # TODO: these should probably be methods on the Bookmark class 
    340             $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; 
    345341            my $template = Template->new; 
    346342            $template->process( 
    347343                'bookmark.tt', 
    348                 $bookmark, 
     344                { bookmark => $bookmark }, 
    349345                \my $output, 
    350346            ); 
Note: See TracChangeset for help on using the changeset viewer.