]> iEval git - plack-app-gruntmaster.git/commitdiff
Keep log query parameters when changing page
authorMarius Gavrilescu <marius@ieval.ro>
Sun, 25 Jan 2015 20:23:57 +0000 (22:23 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sun, 25 Jan 2015 20:23:57 +0000 (22:23 +0200)
lib/Plack/App/Gruntmaster/HTML.pm

index e84f6003d70a54f7972a24dfc61911a23e185d20..3306be2100508109375494120dfba633ef897bdd 100644 (file)
@@ -234,6 +234,13 @@ sub process_log {
        $tree->find('table')->find('tbody')->find('tr')->iter3($args{log}, $iter);
        $args{next_page} ? $tree->fclass('next')->namedlink($args{next_page}, 'Next') : $tree->fclass('next')->detach;
        $args{previous_page} ? $tree->fclass('previous')->namedlink($args{previous_page}, 'Previous') : $tree->fclass('previous')->detach;
+       for my $cls (qw/next previous/) {
+               my $elem = $tree->fclass($cls);
+               next unless $elem;
+               delete $args{args}{page};
+               my $str = join '&', map { $_ . '=' . $args{args}{$_} } keys $args{args};
+               $elem->find('a')->edit_href(sub{s/$/&$str/});
+       }
        $tree->fclass('current')->replace_content("Page $args{current_page} of $args{last_page}");
 }
 
This page took 0.025795 seconds and 4 git commands to generate.