]> iEval git - gruntmaster-page.git/blobdiff - lib/Plack/App/Gruntmaster/HTML.pm
Remove trailing & from prev/next page links in log
[gruntmaster-page.git] / lib / Plack / App / Gruntmaster / HTML.pm
index fe7e4964ebe02507e0f86b4d281667bb0636c593..cd65088a44a40c83fb7e7b21ac3d833897f2788e 100644 (file)
@@ -32,7 +32,7 @@ sub HTML::Element::iter3 {
 }
 
 sub HTML::Element::fid    { shift->look_down(id    => shift) }
-sub HTML::Element::fclass { shift->look_down(class => shift) }
+sub HTML::Element::fclass { shift->look_down(class => qr/\b$_[0]\b/) }
 
 sub HTML::Element::namedlink {
        my ($self, $id, $name) = @_;
@@ -122,6 +122,7 @@ sub process_ct_entry {
                stop        => ftime   $args{stop},
                status      => $status,
                description => literal $args{description});
+       $tree->fid('ctcountdown')->detach if $args{time} >= $args{stop};
 }
 
 sub process_ct {
@@ -161,11 +162,13 @@ sub process_pb_entry {
                $tree->fid('solution_modal')->fclass('modal-body')->replace_content(literal $args{solution});
        }
        if ($args{cansubmit}) {
+               $tree->fid('nosubmit')->detach;
                $tree->look_down(name => 'problem')->attr(value => $args{id});
                my $contest = $tree->look_down(name => 'contest');
                $contest->attr(value => $args{contest}) if $args{contest};
                $contest->detach unless $args{contest}
        } else {
+               $tree->fid('nosubmit')->find('a')->edit_href(sub{s/id/$args{id}/});
                $tree->fid('submit')->detach
        }
 }
@@ -246,7 +249,7 @@ sub process_log {
                next unless $elem;
                delete $args{args}{page};
                my $str = join '&', map { $_ . '=' . $args{args}{$_} } keys %{$args{args}};
-               $elem->find('a')->edit_href(sub{s/$/&$str/});
+               $elem->find('a')->edit_href(sub{s/$/&$str/}) if $str;
        }
        $tree->fclass('current')->replace_content("Page $args{current_page} of $args{last_page}");
 }
This page took 0.022828 seconds and 4 git commands to generate.