Changeset 35 in bookmarks


Ignore:
Timestamp:
05/25/13 02:01:08 (12 years ago)
Author:
peter
Message:

simplified the processing of the tag query parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BookmarkApp.pm

    r33 r35  
    6969    # list all the bookmarks  
    7070    my $format = $q->param('format') || 'html'; 
    71     my $tag = $q->param('tag'); 
    72     my @tags = $q->param('tag'); 
    73     # special case: handle the empty tag 
    74     if (@tags == 1 && $tags[0] eq '') { 
    75         @tags = (); 
    76     } 
     71 
     72    my @tags = grep { $_ ne '' } $q->param('tag'); 
    7773    my $limit = $q->param('limit'); 
    7874    my $offset = $q->param('offset'); 
     
    8278        offset => $offset, 
    8379    }); 
    84     my @all_tags = $bookmarks->get_tags({ selected => $tag }); 
     80    my @all_tags = $bookmarks->get_tags({ selected => $tags[0] }); 
    8581    my @cotags = $bookmarks->get_cotags({ tag => \@tags }); 
    8682     
     
    186182                base_url     => $base_url, 
    187183                title        => $title, 
    188                 selected_tag => $tag, 
     184                selected_tag => $tags[0], 
    189185                search_tags  => \@tags, 
    190186                links        => \@links, 
     
    201197    my $q = $self->query; 
    202198 
    203     my $tag = $q->param('tag'); 
    204     my @tags = $q->param('tag'); 
    205     # special case: handle the empty tag 
    206     if (@tags == 1 && $tags[0] eq '') { 
    207         @tags = (); 
    208     } 
    209  
     199    my @tags = grep { $_ ne '' } $q->param('tag'); 
    210200    my $title = 'Bookmarks' . (@tags ? " tagged as " . join(' & ', @tags) : ''); 
    211201 
Note: See TracChangeset for help on using the changeset viewer.