]> iEval git - plack-app-gruntmaster.git/blobdiff - lib/Plack/App/Gruntmaster/HTML.pm
Add editorial header
[plack-app-gruntmaster.git] / lib / Plack / App / Gruntmaster / HTML.pm
index fe7e4964ebe02507e0f86b4d281667bb0636c593..ce7ca7968d94cf733fd6e72d1b5f8d1584fd9d41 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) = @_;
@@ -114,6 +114,7 @@ sub process_us {
 sub process_ct_entry {
        my ($tree, %args) = @_;
        $_->edit_href (sub {s/contest_id/$args{id}/}) for $tree->find('a');
+       $tree->fid('editorial')->detach unless $args{finished};
        $tree->fid('links')->detach unless $args{started};
        my $status = ($args{time} < $args{start} ? 'starts' : 'ends');
        $tree->fclass('timer')->attr('data-stop', $status eq 'ends' ? $args{stop} : $args{start});
@@ -122,6 +123,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 +163,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
        }
 }
@@ -274,6 +278,7 @@ sub process_st {
 
 sub process_ed {
        my ($tree, %args) = @_;
+       $tree->content_handler(editorial => literal $args{editorial});
        my $iter = sub {
                my ($data, $div) = @_;
                $div->set_child_content(class => 'value', $data->{value});
This page took 0.025622 seconds and 4 git commands to generate.