}
span.i{
- color: #F00;
+ color: #C00;
}
span.Eval{
- color: #0F0;
+ color: #0C0;
}
footer{
div.container-fluid {
padding: 0 15px;
-}
\ No newline at end of file
+}
+
+.list-group-item {
+ max-width: 30em;
+}
use strict;
use warnings;
+use Encode qw/encode/;
use File::Slurp qw/read_file/;
use HTML::Template::Compiled;
en => <<'HTML',
<!DOCTYPE html>
<title>TITLE_GOES_HERE</title>
-<link rel="stylesheet" href="/static/gm.css">
-<script src="/static/zepto.var" defer></script>
-<script src="/static/view.js" defer></script>
-<script src="/static/form.js" defer></script>
<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<span id="admin"></span>
-<div id="title"><span class="i">i</span><span class="Eval">Eval</span></div>
-<div id="subtitle">TITLE_GOES_HERE</div>
+<link rel="stylesheet" href="/css/cyborg" id="stylesheet">
+<script src="/js" type="text/javascript"></script>
+
+<nav class="navbar navbar-default navbar-static-top" role="navigation">
+<div class="container-fluid">
+<div class="navbar-header">
+<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
+<a class="navbar-brand" href="/">Gruntmaster 6000</a>
+</div>
-<nav><ul>
-<li><a href="/pb/">Problems</a>
+<div class="collapse navbar-collapse">
+<ul class="nav navbar-nav">
+<li><a href="/pb/">Problem list</a>
<li><a href="/ct/">Contests</a>
-<li><a href="/log/">Job log</a></ul></nav>
+<li><a href="/account">Account</a>
+</ul>
+
+<ul class="nav navbar-nav navbar-right">
+<li><a class="dropdown-toggle" data-toggle="dropdown"> Theme <span class="caret"></span></a>
+
+<ul class="dropdown-menu" role="menu">
+<li><a href="#" id="theme_slate">Gunmetal gray</a>
+<li><a href="#" id="theme_cyborg">Black</a>
+<li><a href="#" id="theme_cerulean">White</a>
+<li><a href="#" id="theme_cosmo">Metro</a>
+</ul>
+
+<li><a href="/log/">Job log</a>
+</ul>
+</div>
+</div>
+</nav>
+
+<div class="container-fluid">
+
+<div id="title"><span class="i">i</span><span class="Eval">Eval</span></div>
+<div id="subtitle">TITLE_GOES_HERE</div>
HTML
);
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 {}
debug $logger => "";
my $js;
$js .= read_file $_ for <js/*.js>;
- [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]] }
use constant TEMPLATES => {
en => <<'HTML',
-<table border>
+<table border class="table table-bordered table-striped">
<thead>
<tr><th>ID<th>Problem<th>Date<th>Size<th>User<th>Result
<tbody>
<tmpl_loop log><tr><td><a href="job/<tmpl_var id>"><tmpl_var id></a>
-<td><a href="pb/<tmpl_var problem>"><tmpl_var name></a>
+<td><a href="../pb/<tmpl_var problem>"><tmpl_var name></a>
<td><tmpl_var date>
<td><a href="src/<tmpl_var id>.<tmpl_var extension>"<tmpl_if private> data-private</tmpl_if>><tmpl_var size></a>
<td><tmpl_var user><td class="r<tmpl_var result>"><tmpl_var result_text>
</tmpl_loop>
</table>
-<tmpl_if prev><a href="<tmpl_var prev>">Prev page</a></tmpl_if>
-<tmpl_if next><a href="<tmpl_var next>">Next page</a></tmpl_if>
+<ul class="pager">
+<tmpl_if prev><li class="previous"><a href="<tmpl_var prev>">Previous</a></tmpl_if>
+<tmpl_if next><li class="next"><a href="<tmpl_var next>">Next</a></tmpl_if>
+</ul>
HTML
};
my $pages = POSIX::floor (jobcard / PAGE_SIZE);
$pages ||= 1;
- $page //= $pages;
+ $page ||= $pages;
my @log = sort { $b->{id} <=> $a->{id} } map +{
id => $_,
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 = ();
en => <<'HTML',
<tmpl_if levels>
<h2>Beginner</h2>
-<ul>
-<tmpl_loop beginner><li><a href="<tmpl_var id>"><tmpl_var name></a>
-</tmpl_loop></ul>
+<div class="list-group">
+<tmpl_loop beginner><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></div>
<h2>Easy</h2>
-<ul>
-<tmpl_loop easy><li><a href="<tmpl_var id>"><tmpl_var name></a>
-</tmpl_loop></ul>
+<div class="list-group">
+<tmpl_loop easy><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></div>
<h2>Medium</h2>
-<ul>
-<tmpl_loop medium><li><a href="<tmpl_var id>"><tmpl_var name></a>
-</tmpl_loop></ul>
+<div class="list-group">
+<tmpl_loop medium><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></div>
<h2>Hard</h2>
-<ul>
-<tmpl_loop hard><li><a href="<tmpl_var id>"><tmpl_var name></a>
-</tmpl_loop></ul>
+<div class="list-group">
+<tmpl_loop hard><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></div>
<tmpl_else>
-<ul>
-<tmpl_loop problems><li><a href="<tmpl_var id>"><tmpl_var name></a>
-</tmpl_loop></ul>
+<div class="list-group">
+<tmpl_loop problems><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></div>
</tmpl_if>
HTML
};
use constant TEMPLATES => {
en => <<'HTML',
+<div class="row">
+<div class="col-md-9">
<tmpl_var ESCAPE=0 statement>
+</div>
+<div class="col-md-3">
<tmpl_if cansubmit>
<h1>Submit solution</h1>
-<form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data">
+<form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data" role="form">
<input type="hidden" name="problem" value="<tmpl_var id>">
<tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined>
-<label>File: <input name="prog" required type="file"></label>
-<label>File format: <select name="prog_format" required>
+<div class="form-group"><label for="prog">File:</label><input id="prog" name="prog" required type="file"></div>
+<div class="form-group"><label for="source_code">Source code:</label> <textarea class="form-control" id="source_code" name="source_code"></textarea></div>
+<div class="form-group"><label for="prog_format">File format:</label><select id="prog_format" name="prog_format" class="form-control" required>
<tmpl_loop formats><option value="<tmpl_var _>"><tmpl_var _></option>
-</tmpl_loop></select></label>
+</tmpl_loop></select></div>
-<input type="submit" value="Submit job">
+<input type="submit" value="Submit job" class="btn btn-primary">
</form>
</tmpl_if>
+</div>
HTML
};
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);
}
use constant TEMPLATES => {
en => <<'HTML',
-<ol><tmpl_loop users><li><a href="<tmpl_var id>"><tmpl_var name></a>
+<div class="list-group"><tmpl_loop users><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
</tmpl_loop></ol>
HTML
};