Changeset 88 in bookmarks for trunk/lib/Bookmarks/Controller.pm


Ignore:
Timestamp:
06/04/15 22:00:25 (9 years ago)
Author:
peter
Message:

Better separation of the model for searching and the web app controller/representation layer

  • renamed Bookmarks::get_bookmarks() to search()
  • Bookmarks::search() now returns a Bookmarks::Search object instead of a Bookmarks::List
  • search results now reside in the Bookmarks::Search class
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Bookmarks/Controller.pm

    r75 r88  
    77use JSON; 
    88use Bookmarks; 
     9use Bookmarks::List; 
    910use URI; 
    1011use Template; 
     
    8384    my $offset = $self->request->param('offset'); 
    8485 
    85     my $list = $self->bookmarks->get_bookmarks({ 
    86         query  => $query, 
    87         tags   => \@tags, 
    88         limit  => $limit, 
    89         offset => $offset, 
     86    my $list = Bookmarks::List->new({ 
     87        bookmarks => $self->bookmarks, 
     88        search    => $self->bookmarks->search({ 
     89            query  => $query, 
     90            tags   => \@tags, 
     91            limit  => $limit, 
     92            offset => $offset, 
     93        }), 
    9094    }); 
    9195 
     
    104108 
    105109    # construct a feed from the most recent 12 bookmarks 
    106     my $list = $self->bookmarks->get_bookmarks({ query => $query, tags => \@tags, limit => 12 }); 
     110    my $list = Bookmarks::List->new({ 
     111        bookmarks => $self->bookmarks, 
     112        search    => $self->bookmarks->search({ query => $query, tags => \@tags, limit => 12 }), 
     113    }); 
    107114    return $list->as_atom; 
    108115} 
Note: See TracChangeset for help on using the changeset viewer.