From: Marius Gavrilescu Date: Sat, 21 Mar 2015 11:36:45 +0000 (+0200) Subject: Merge branch 'master' into newmc X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=9694ccf33654e0cc01a2fa9390b76eb1a276d304;hp=f6644739ff3776376510450a3ab8514b0c3b78d4;p=plack-app-gruntmaster.git Merge branch 'master' into newmc --- diff --git a/css/themes/cyborg.css b/css/themes/cyborg.css index 5d80614..e0a75ae 100644 --- a/css/themes/cyborg.css +++ b/css/themes/cyborg.css @@ -1,5 +1,5 @@ /*! - * bootswatch v3.3.2 + * bootswatch v3.3.4 * Homepage: http://bootswatch.com * Copyright 2012-2015 Thomas Park * Licensed under MIT @@ -363,6 +363,9 @@ hr { overflow: visible; clip: auto; } +[role="button"] { + cursor: pointer; +} h1, h2, h3, @@ -1055,10 +1058,13 @@ output { .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { - cursor: not-allowed; background-color: #adafae; opacity: 1; } +.form-control[disabled], +fieldset[disabled] .form-control { + cursor: not-allowed; +} textarea.form-control { height: auto; } @@ -1125,6 +1131,7 @@ input[type="search"] { } .radio-inline, .checkbox-inline { + position: relative; display: inline-block; padding-left: 20px; margin-bottom: 0; @@ -1161,6 +1168,7 @@ fieldset[disabled] .checkbox label { padding-top: 9px; padding-bottom: 9px; margin-bottom: 0; + min-height: 34px; } .form-control-static.input-lg, .form-control-static.input-sm { @@ -1202,6 +1210,7 @@ select[multiple].form-group-sm .form-control { padding: 5px 10px; font-size: 12px; line-height: 1.5; + min-height: 32px; } .input-lg { height: 54px; @@ -1238,6 +1247,7 @@ select[multiple].form-group-lg .form-control { padding: 14px 16px; font-size: 18px; line-height: 1.3333333; + min-height: 38px; } .has-feedback { position: relative; @@ -1673,11 +1683,9 @@ input[type="button"].btn-block { } .collapse { display: none; - visibility: hidden; } .collapse.in { display: block; - visibility: visible; } tr.collapse.in { display: table-row; @@ -1932,7 +1940,7 @@ button.close { right: 0; bottom: 0; left: 0; - z-index: 1040; + z-index: 1050; -webkit-overflow-scrolling: touch; outline: 0; } @@ -1973,10 +1981,12 @@ button.close { outline: 0; } .modal-backdrop { - position: absolute; + position: fixed; top: 0; right: 0; + bottom: 0; left: 0; + z-index: 1040; background-color: #000000; } .modal-backdrop.fade { @@ -2104,7 +2114,6 @@ button.close { } .hidden { display: none !important; - visibility: hidden !important; } .affix { position: fixed; diff --git a/css/themes/readable.css b/css/themes/readable.css index 14c47d6..c9df180 100644 --- a/css/themes/readable.css +++ b/css/themes/readable.css @@ -1,5 +1,5 @@ /*! - * bootswatch v3.3.2 + * bootswatch v3.3.4 * Homepage: http://bootswatch.com * Copyright 2012-2015 Thomas Park * Licensed under MIT @@ -363,6 +363,9 @@ hr { overflow: visible; clip: auto; } +[role="button"] { + cursor: pointer; +} h1, h2, h3, @@ -1055,10 +1058,13 @@ output { .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { - cursor: not-allowed; background-color: #eeeeee; opacity: 1; } +.form-control[disabled], +fieldset[disabled] .form-control { + cursor: not-allowed; +} textarea.form-control { height: auto; } @@ -1125,6 +1131,7 @@ input[type="search"] { } .radio-inline, .checkbox-inline { + position: relative; display: inline-block; padding-left: 20px; margin-bottom: 0; @@ -1161,6 +1168,7 @@ fieldset[disabled] .checkbox label { padding-top: 9px; padding-bottom: 9px; margin-bottom: 0; + min-height: 38px; } .form-control-static.input-lg, .form-control-static.input-sm { @@ -1202,6 +1210,7 @@ select[multiple].form-group-sm .form-control { padding: 5px 10px; font-size: 14px; line-height: 1.5; + min-height: 36px; } .input-lg { height: 57px; @@ -1238,6 +1247,7 @@ select[multiple].form-group-lg .form-control { padding: 14px 16px; font-size: 20px; line-height: 1.3333333; + min-height: 42px; } .has-feedback { position: relative; @@ -1673,11 +1683,9 @@ input[type="button"].btn-block { } .collapse { display: none; - visibility: hidden; } .collapse.in { display: block; - visibility: visible; } tr.collapse.in { display: table-row; @@ -1932,7 +1940,7 @@ button.close { right: 0; bottom: 0; left: 0; - z-index: 1040; + z-index: 1050; -webkit-overflow-scrolling: touch; outline: 0; } @@ -1973,10 +1981,12 @@ button.close { outline: 0; } .modal-backdrop { - position: absolute; + position: fixed; top: 0; right: 0; + bottom: 0; left: 0; + z-index: 1040; background-color: #000000; } .modal-backdrop.fade { @@ -2104,7 +2114,6 @@ button.close { } .hidden { display: none !important; - visibility: hidden !important; } .affix { position: fixed; diff --git a/css/themes/slate.css b/css/themes/slate.css index 7e9ac71..f722ec2 100644 --- a/css/themes/slate.css +++ b/css/themes/slate.css @@ -1,5 +1,5 @@ /*! - * bootswatch v3.3.2 + * bootswatch v3.3.4 * Homepage: http://bootswatch.com * Copyright 2012-2015 Thomas Park * Licensed under MIT @@ -363,6 +363,9 @@ hr { overflow: visible; clip: auto; } +[role="button"] { + cursor: pointer; +} h1, h2, h3, @@ -1055,10 +1058,13 @@ output { .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { - cursor: not-allowed; background-color: #999999; opacity: 1; } +.form-control[disabled], +fieldset[disabled] .form-control { + cursor: not-allowed; +} textarea.form-control { height: auto; } @@ -1125,6 +1131,7 @@ input[type="search"] { } .radio-inline, .checkbox-inline { + position: relative; display: inline-block; padding-left: 20px; margin-bottom: 0; @@ -1161,6 +1168,7 @@ fieldset[disabled] .checkbox label { padding-top: 9px; padding-bottom: 9px; margin-bottom: 0; + min-height: 34px; } .form-control-static.input-lg, .form-control-static.input-sm { @@ -1202,6 +1210,7 @@ select[multiple].form-group-sm .form-control { padding: 5px 10px; font-size: 12px; line-height: 1.5; + min-height: 32px; } .input-lg { height: 54px; @@ -1238,6 +1247,7 @@ select[multiple].form-group-lg .form-control { padding: 14px 16px; font-size: 18px; line-height: 1.3333333; + min-height: 38px; } .has-feedback { position: relative; @@ -1673,11 +1683,9 @@ input[type="button"].btn-block { } .collapse { display: none; - visibility: hidden; } .collapse.in { display: block; - visibility: visible; } tr.collapse.in { display: table-row; @@ -1932,7 +1940,7 @@ button.close { right: 0; bottom: 0; left: 0; - z-index: 1040; + z-index: 1050; -webkit-overflow-scrolling: touch; outline: 0; } @@ -1973,10 +1981,12 @@ button.close { outline: 0; } .modal-backdrop { - position: absolute; + position: fixed; top: 0; right: 0; + bottom: 0; left: 0; + z-index: 1040; background-color: #000000; } .modal-backdrop.fade { @@ -2104,7 +2114,6 @@ button.close { } .hidden { display: none !important; - visibility: hidden !important; } .affix { position: fixed; diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index 7a3dc34..9284acc 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -71,7 +71,7 @@ sub problem { db->problem ($_{problem}) } sub job { db->job ($_{job}) } sub user { db->user ($_{user}) } -sub redirect { [301, ['X-Forever' => 1, 'Location' => $_[0]], []] } +sub redirect { [301, ['X-Forever' => 1, 'Cache-Control' => 'public, max-age=86400', 'Location' => $_[0]], []] } sub reply { [200, ['Content-Type' => 'text/plain; charset=utf-8'], \@_] } sub response { my ($template, $title, $params, $maxage) = @_; @@ -81,7 +81,7 @@ sub response { } $params->{time} = time; $params->{args} = {%_}; - bless {template => $template, title => $title, params => $params, maxage => ($maxage // 1)}, __PACKAGE__.'::Response' + bless {template => $template, title => $title, params => $params, maxage => ($maxage // 3600)}, __PACKAGE__.'::Response' } sub forbid { @@ -135,7 +135,7 @@ sub dispatch_request{ sub (/ed/:contest) { forbid !contest->is_finished; my $pblist = db->problem_list(contest => $_{contest}, solution => 1); - response ed => 'Editorial of ' . contest->name, {%$pblist, editorial => contest->editorial}; + response ed => 'Editorial of ' . contest->name, {%$pblist, editorial => contest->editorial}, contest->is_finished(time - 86400) ? 60 : (); }, sub (/login) { @@ -146,10 +146,10 @@ sub dispatch_request{ sub (/ct/:contest/log/st) { redirect "/st/$_{contest}" }, sub (/us/) { response us => 'Users', {us => db->user_list} }, - sub (/ct/ + ?:owner~) { response ct => 'Contests', db->contest_list(%_) }, + sub (/ct/ + ?:owner~) { response ct => 'Contests', db->contest_list(%_), 300 }, sub (/log/ + ?:contest~&:owner~&:page~&:problem~&:private~&:result~) { forbid $_{private}; - response log => 'Job list', {%{db->job_list(%_)}, maybe contest => $_{contest},} + response log => 'Job list', db->job_list(%_), 5 }, sub (/pb/ + ?:owner~&:contest~&:private~) { forbid $_{private}; @@ -158,10 +158,10 @@ sub dispatch_request{ }, sub (/us/:user) { response us_entry => user->name, db->user_entry($_{user}) }, - sub (/ct/:contest) { response ct_entry => contest->name, db->contest_entry($_{contest}) }, + sub (/ct/:contest) { response ct_entry => contest->name, db->contest_entry($_{contest}), 60 }, sub (/log/:job) { forbid job->private; - response log_entry => "Job $_{job}", db->job_entry($_{job}) + response log_entry => "Job $_{job}", db->job_entry($_{job}), 10 }, sub (/pb/:problem + ?contest~) { my (undef, undef, $contest) = @_; @@ -173,7 +173,7 @@ sub dispatch_request{ forbid !remote_user; $privacy = 'private'; } - response pb_entry => problem->name, {%{db->problem_entry($_{problem}, $_{contest}, remote_user && remote_user->id)}, maybe contest => $_{contest}}; + response pb_entry => problem->name, db->problem_entry($_{problem}, $_{contest}, remote_user && remote_user->id), $_{contest} ? 10 : (); }, sub (/sol/:problem) { forbid problem->private; @@ -182,7 +182,7 @@ sub dispatch_request{ sub (/) { redispatch_to '/index' }, sub (/favicon.ico) { redirect '/static/favicon.ico' }, - sub (/:article) { [200, ['Content-Type' => 'text/html; charset=utf-8', 'Cache-Control' => 'public, max-age=60', 'X-Forever' => 1], [render_article $_{article}, 'en']] } + sub (/:article) { [200, ['Content-Type' => 'text/html; charset=utf-8', 'Cache-Control' => 'public, max-age=3600', 'X-Forever' => 1], [render_article $_{article}, 'en']] } }, sub (POST) { diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index 59ee377..382641e 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -172,8 +172,8 @@ sub process_pb_entry { $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} + $contest->attr(value => $args{args}{contest}) if $args{args}{contest}; + $contest->detach unless $args{args}{contest} } else { $tree->fid('nosubmit')->find('a')->edit_href(sub{s/id/$args{id}/}); $tree->fid('submit')->detach @@ -237,7 +237,7 @@ sub process_log { my ($data, $tr) = @_; $tr->fclass('id')->namedlink($data->{id}); $tr->fclass('problem')->namedlink($data->{problem}, $data->{problem_name}); - $tr->fclass('problem')->find('a')->edit_href(sub{$_ .= "?contest=$args{contest}"}) if $args{contest}; + $tr->fclass('problem')->find('a')->edit_href(sub{$_ .= "?contest=$args{args}{contest}"}) if $args{args}{contest}; $tr->fclass('contest')->namedlink($data->{contest}, $data->{contest_name}) if $data->{contest}; $tr->fclass('contest')->replace_content('None') unless $data->{contest}; $tr->fclass('date')->replace_content(ftime $data->{date});