From a94f84535623ae0de44b63290aa4c8b1bf3e5eaa Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Tue, 4 Feb 2014 20:46:35 +0200 Subject: [PATCH] Modernize templates --- css/custom.css | 10 +++++-- lib/Gruntmaster/Page/Base.pm | 49 ++++++++++++++++++++++++------- lib/Gruntmaster/Page/JS.pm | 2 +- lib/Gruntmaster/Page/Log.pm | 12 ++++---- lib/Gruntmaster/Page/Log/Entry.pm | 2 +- lib/Gruntmaster/Page/Pb.pm | 30 +++++++++---------- lib/Gruntmaster/Page/Pb/Entry.pm | 18 ++++++++---- lib/Gruntmaster/Page/Us.pm | 2 +- 8 files changed, 82 insertions(+), 43 deletions(-) diff --git a/css/custom.css b/css/custom.css index e4042ee..3511469 100644 --- a/css/custom.css +++ b/css/custom.css @@ -15,11 +15,11 @@ div#subtitle{ } span.i{ - color: #F00; + color: #C00; } span.Eval{ - color: #0F0; + color: #0C0; } footer{ @@ -56,4 +56,8 @@ a.thumbnail { div.container-fluid { padding: 0 15px; -} \ No newline at end of file +} + +.list-group-item { + max-width: 30em; +} diff --git a/lib/Gruntmaster/Page/Base.pm b/lib/Gruntmaster/Page/Base.pm index a7188d7..47beca7 100644 --- a/lib/Gruntmaster/Page/Base.pm +++ b/lib/Gruntmaster/Page/Base.pm @@ -4,6 +4,7 @@ use 5.014000; use strict; use warnings; +use Encode qw/encode/; use File::Slurp qw/read_file/; use HTML::Template::Compiled; @@ -36,20 +37,46 @@ my %orig_header_templates = ( en => <<'HTML', TITLE_GOES_HERE - - - - + - -
iEval
-
TITLE_GOES_HERE
+ + + + + +
+ +
iEval
+
TITLE_GOES_HERE
HTML ); @@ -114,7 +141,7 @@ sub generate{ my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$self}{$lang}, default_escape => 'HTML',); $self->_generate($htc, $lang, @args); - [200, ['Content-Type' => 'text/html', 'Content-Language' => $_[1]], [ $htc->output ] ] + [200, ['Content-Type' => 'text/html', 'Content-Language' => $_[1]], [ encode 'UTF-8' => $htc->output ] ] } sub _generate {} diff --git a/lib/Gruntmaster/Page/JS.pm b/lib/Gruntmaster/Page/JS.pm index ce4c336..fa00293 100644 --- a/lib/Gruntmaster/Page/JS.pm +++ b/lib/Gruntmaster/Page/JS.pm @@ -15,7 +15,7 @@ sub generate{ debug $logger => ""; my $js; $js .= read_file $_ for ; - [200, ['Content-Type' => 'application/javascript', 'Cache-Control' => 'max-age=604800'], [minify $js] ] + [200, ['Content-Type' => 'application/javascript', 'Cache-Control' => 'max-age=604800'], [$js] ] } sub variants{ [[js => 1, 'application/javascript', undef, undef, undef, undef]] } diff --git a/lib/Gruntmaster/Page/Log.pm b/lib/Gruntmaster/Page/Log.pm index f46e6a9..19862a8 100644 --- a/lib/Gruntmaster/Page/Log.pm +++ b/lib/Gruntmaster/Page/Log.pm @@ -11,20 +11,22 @@ use constant PAGE_SIZE => 10; use constant TEMPLATES => { en => <<'HTML', - +
IDProblemDateSizeUserResult
- + data-private>
-Prev page -Next page + HTML }; @@ -35,7 +37,7 @@ sub _generate{ my $pages = POSIX::floor (jobcard / PAGE_SIZE); $pages ||= 1; - $page //= $pages; + $page ||= $pages; my @log = sort { $b->{id} <=> $a->{id} } map +{ id => $_, diff --git a/lib/Gruntmaster/Page/Log/Entry.pm b/lib/Gruntmaster/Page/Log/Entry.pm index beceae7..f3e3236 100644 --- a/lib/Gruntmaster/Page/Log/Entry.pm +++ b/lib/Gruntmaster/Page/Log/Entry.pm @@ -25,7 +25,7 @@ HTML sub _generate{ my ($self, $htc, $lang, $logger, $ct, $id) = @_; - debug $logger => "language is $lang, contest is $ct and id is $id"; + debug $logger => "language is '$lang', contest is '$ct' and id is '$id'"; local $Gruntmaster::Data::contest = $ct; my @tests = (); diff --git a/lib/Gruntmaster/Page/Pb.pm b/lib/Gruntmaster/Page/Pb.pm index da518de..7a9a0c2 100644 --- a/lib/Gruntmaster/Page/Pb.pm +++ b/lib/Gruntmaster/Page/Pb.pm @@ -11,29 +11,29 @@ use constant TEMPLATES => { en => <<'HTML',

Beginner

-
    -
  • -
+
+ +

Easy

-
    -
  • -
+
+ +

Medium

-
    -
  • -
+
+ +

Hard

-
    -
  • -
+
+ +
-
    -
  • -
+
+ +
HTML }; diff --git a/lib/Gruntmaster/Page/Pb/Entry.pm b/lib/Gruntmaster/Page/Pb/Entry.pm index b45887f..6df5e5e 100644 --- a/lib/Gruntmaster/Page/Pb/Entry.pm +++ b/lib/Gruntmaster/Page/Pb/Entry.pm @@ -9,22 +9,28 @@ our $VERSION = '0.001'; use constant TEMPLATES => { en => <<'HTML', +
+
+
+

Submit solution

-
+ - -
+
+
+
- + +
HTML }; @@ -33,7 +39,7 @@ sub _generate{ debug $logger => "language is '$lang', contest is '$contest', id is '$id'"; $htc->param(cansubmit => 1); - if (defined $contest) { + if ($contest) { $htc->param(cansubmit => time <= contest_end $contest); $htc->param(contest => $contest); } diff --git a/lib/Gruntmaster/Page/Us.pm b/lib/Gruntmaster/Page/Us.pm index f4b3981..0ca1e29 100644 --- a/lib/Gruntmaster/Page/Us.pm +++ b/lib/Gruntmaster/Page/Us.pm @@ -9,7 +9,7 @@ our $VERSION = '0.001'; use constant TEMPLATES => { en => <<'HTML', -
  1. +
HTML }; -- 2.39.2