From 4a3952b20e4aea2e548cbd806953e4d7c61f495f Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 25 Jan 2015 22:23:57 +0200 Subject: [PATCH] Keep log query parameters when changing page --- lib/Plack/App/Gruntmaster/HTML.pm | 7 +++++++ 1 file changed, 7 insertions(+) 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}"); } -- 2.39.2