From: Marius Gavrilescu Date: Sun, 25 Jan 2015 20:23:57 +0000 (+0200) Subject: Keep log query parameters when changing page X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=4a3952b20e4aea2e548cbd806953e4d7c61f495f;p=gruntmaster-page.git Keep log query parameters when changing page --- diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index e84f600..3306be2 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -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}"); }