Changeset 107 in bookmarks for trunk/lib/BookmarksApp.pm


Ignore:
Timestamp:
11/09/15 20:21:41 (8 years ago)
Author:
peter
Message:

Added a /tags resource that provides a drilldown inteface to the tags and bookmarks. URI pattern is /tags/{tag1}/{tag2}/{tag3...}

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/BookmarksApp.pm

    r101 r107  
    8282        }; 
    8383 
     84        resource '/tags' => sub { 
     85            GET { 
     86                my ($env, $params) = @_; 
     87                return $self->_controller->tag_tree; 
     88            }; 
     89        }; 
     90        resource '/tags/*' => sub { 
     91            GET { 
     92                my ($env, $params) = @_; 
     93                my $tag_path = (@{ $params->{splat} })[0]; 
     94                return $self->_controller->tag_tree([ split m{/}, $tag_path ]); 
     95            }; 
     96        }; 
     97 
    8498        resource '/{id}' => sub { 
    8599            GET { 
     
    99113            }; 
    100114        }; 
     115 
    101116    }; 
    102117 
Note: See TracChangeset for help on using the changeset viewer.