From: Marius Gavrilescu Date: Fri, 12 Dec 2014 12:17:21 +0000 (+0200) Subject: Add more information to user page X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=9a8a3012f9b4e88ee890dad545fbd0f2b5624a73;p=plack-app-gruntmaster.git Add more information to user page --- diff --git a/css/custom.css b/css/custom.css index 0da7b4e..429955b 100644 --- a/css/custom.css +++ b/css/custom.css @@ -63,3 +63,19 @@ a.dropdown-toggle{ nav li{ padding: 5px; } + +ul.inline{ + list-style-type: none; +} + +ul.inline li{ + display: inline; +} + +ul.inline li:after { + content: ", "; +} + +ul.inline li:last-child:after { + content: ""; +} \ No newline at end of file diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index a82cafd..4523055 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -79,6 +79,25 @@ sub process_skel { sub process_us_entry { my ($tree, %args) = @_; $tree->fid($_)->attr('href', "/$_/?owner=$args{id}") for qw/log pb/; + my @solved = map { $_->{solved} ? ($_->{problem}) : () } @{$args{problems}}; + my @attempted = map { !$_->{solved} ? ($_->{problem}) : () } @{$args{problems}}; + + my $pbiter = sub { + my ($data, $li) = @_; + $li->find('a')->namedlink($data); + }; + $tree->fid('solved')->find('li')->iter3(\@solved, $pbiter); + $tree->fid('attempted')->find('li')->iter3(\@attempted, $pbiter); + $tree->fid('solved_count')->replace_content(scalar @solved); + $tree->fid('attempted_count')->replace_content(scalar @attempted); + + my $ctiter = sub { + my ($data, $td) = @_; + $td->fclass('contest')->namedlink($data->{contest}); + $td->fclass('score')->replace_content($data->{score}); + $td->fclass('rank')->replace_content($data->{rank}); + }; + $tree->find('table')->find('tbody')->find('tr')->iter3($args{contests}, $ctiter); } sub process_us { diff --git a/tmpl/us_entry.en b/tmpl/us_entry.en index 413e897..62748d5 100644 --- a/tmpl/us_entry.en +++ b/tmpl/us_entry.en @@ -4,5 +4,19 @@
Level
Level
+

Solved problems

+Total 1 + + +

Attempted problems

+Total 1 + + +

Contest results

+ + + +
ContestScoreRank
Test10001
+ Job log
Owned problems