From: Marius Gavrilescu Date: Sat, 11 Apr 2015 11:57:34 +0000 (+0300) Subject: Merge branch 'master' into newmc X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=7cbc093ea2bc5b60c8882ea2358af8cb200e58fc;hp=-c;p=gruntmaster-page.git Merge branch 'master' into newmc --- 7cbc093ea2bc5b60c8882ea2358af8cb200e58fc diff --combined lib/Plack/App/Gruntmaster/HTML.pm index 396f7d9,3cfbc54..8ddd9e1 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@@ -10,7 -10,12 +10,12 @@@ use POSIX qw// use Data::Dumper qw/Dumper/; sub ftime ($) { POSIX::strftime '%c', localtime shift } - sub literal ($) { HTML::Element::Library::super_literal shift // '' } + sub literal ($) { + my $b = HTML::TreeBuilder->new; + $b->ignore_unknown(0); + $b->parse(shift // ''); + HTML::Element::Library::super_literal $b->guts->as_HTML; + } sub HTML::Element::edit_href { my ($self, $sub) = @_; @@@ -79,13 -84,8 +84,13 @@@ sub _render $tree->as_HTML; } +my $logo = read_file 'mclogo.svg'; +$logo =~ y/\n//d; +$logo =~ s/(\s+)/ /g; + sub process_skel { my ($tree, %args) = @_; + $tree->fid('logo')->replace_with(literal $logo); $tree->content_handler( title => $args{title}, content => literal $args{meat}); @@@ -171,7 -171,10 +176,7 @@@ sub process_pb_entry if ($args{contest_stop}) { $tree->fid('solution')->detach; $tree->fid('solution_modal')->detach; - my $score = $tree->fid('score'); - $score->attr('data-start' => $args{open_time}); - $score->attr('data-stop' => $args{contest_stop}); - $score->attr('data-value' => $args{value}); + $tree->fid('score')->replace_content($args{value}); $tree->fid('countdown')->attr('data-stop' => $args{contest_stop}); } else { $tree->fid('job_log')->edit_href(sub{$_ .= "&private=$args{private}"}) if $args{private};