X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FPlack%2FApp%2FGruntmaster%2FHTML.pm;h=6921981215ac79bb7633f082436282a27065c785;hb=c0672e69e5ddca0808d0fe5cc3302886e69bcbe3;hp=2ae8a4410626037942da16ff01399768760f934e;hpb=dc6ca3bcf2500c25510068b38af7e040f23b2dde;p=plack-app-gruntmaster.git diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index 2ae8a44..6921981 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -102,13 +102,12 @@ sub process_us_entry { sub process_us { my ($tree, %args) = @_; - my $item = $tree->fclass('list-group-item'); - $item->replace_with(map { - my $new = $item->clone; - $new->attr(href => $_->{id}); - $new->replace_content($_->{name} || $_->{id}); - $new - } @{$args{us}}); + my $iter = sub { + my ($data, $tr) = @_; + $tr->fclass('user')->namedlink($data->{id}, $data->{name}); + $tr->fclass($_)->replace_content($data->{$_}) for qw/solved attempted contests/; + }; + $tree->find('tbody')->find('tr')->iter3($args{us}, $iter); } sub process_ct_entry { @@ -217,8 +216,8 @@ sub process_log { $tr->fclass('result_text')->attr(class => "r$data->{result}"); }; $tree->find('table')->find('tbody')->find('tr')->iter3($args{log}, $iter); - $args{next_page} ? $tree->fclass('next')->namedlink($args{next_page}, 'Next') : $tree->fclass('next')->attr(class => 'next disabled'); - $args{previous_page} ? $tree->fclass('previous')->namedlink($args{previous_page}, 'Previous') : $tree->fclass('previous')->attr(class => 'previous disabled'); + $args{next_page} ? $tree->fclass('next')->namedlink($args{next_page}, 'Next') : $tree->fclass('next')->detach; + $args{previous_page} ? $tree->fclass('previous')->namedlink($args{previous_page}, 'Previous') : $tree->fclass('previous')->detach; $tree->fclass('current')->replace_content("Page $args{current_page} of $args{last_page}"); }