]> iEval git - plack-app-gruntmaster.git/commitdiff
Add a Track user link on us_entry
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Dec 2014 16:17:42 +0000 (18:17 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Dec 2014 16:17:42 +0000 (18:17 +0200)
js/90-tracker.js
lib/Plack/App/Gruntmaster/HTML.pm
tmpl/us_entry.en

index 812a4777e420c0bd4c0b477f48da047007852ce2..a475ee850bd5ad5fbbd00c5b84c5e30efa6165ec 100644 (file)
@@ -98,6 +98,8 @@
                $('#tracker').detach().prependTo($('#sidebar')).removeClass('hidden');
                $('#tracker_button').on('click', function() { start_tracking($('#tracker_username').val()) });
                $('#tracker_stop').on('click', stop_tracking);
+               $('#track_user').removeClass('hidden');
+               $('#track_user').on('click', function() { stop_tracking(); start_tracking($(this).data('user')) });
 
                if(localStorage.getItem('tracker_username'))
                        start_tracking(localStorage.getItem('tracker_username'));
index 6921981215ac79bb7633f082436282a27065c785..f0952cf6228cc468aa77155a9a30a28581853591 100644 (file)
@@ -79,6 +79,7 @@ sub process_skel {
 sub process_us_entry {
        my ($tree, %args) = @_;
        $tree->fid($_)->attr('href', "/$_/?owner=$args{id}") for qw/log pb/;
+       $tree->fid('track_user')->attr('data-user', $args{id});
        my @solved = map { $_->{solved} ? ($_->{problem}) : () } @{$args{problems}};
        my @attempted = map { !$_->{solved} ? ($_->{problem}) : () } @{$args{problems}};
 
index 62748d5b7b6f8f0e64911bc4b403cb4a4b63b617..65fb98fffe0a9e1e6248d99d67d1f95cba128055 100644 (file)
@@ -4,6 +4,10 @@
 <dt>Level</dt> <dd smap="level">Level</dd>
 </dl>
 
+<a href="#" id="track_user" data-user="id" class="hidden">Track user</a><br>
+<a href="/log/?owner=id" id="log">Job log</a><br>
+<a href="/pb/?owner=id" id="pb">Owned problems</a>
+
 <h1>Solved problems</h1>
 Total <strong id="solved_count">1</strong>
 <ul class="inline" id="solved"><li><a href="/pb/id">problem_id</a></ul>
@@ -17,6 +21,3 @@ Total <strong id="attempted_count">1</strong>
 <thead><tr><th>Contest<th>Score<th>Rank</thead>
 <tbody><tr><td class="contest"><a href="/ct/id">Test<td class="score">1000<td class="rank">1</tbody>
 </table>
-
-<a href="/log/?owner=id" id="log">Job log</a><br>
-<a href="/pb/?owner=id" id="pb">Owned problems</a>
This page took 0.027811 seconds and 4 git commands to generate.