]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/player_info.mako
Add noscript warnings for both charts.
[xonotic/xonstat.git] / xonstat / templates / player_info.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3
4 <%block name="navigation">
5 ${nav.nav('players')}
6 </%block>
7
8 <%block name="css">
9 ${parent.css()}
10 <link href="/static/css/sprites.css" rel="stylesheet">
11 <link href="/static/css/nv.d3.css" rel="stylesheet" type="text/css">
12 <style>
13 #damageChartSVG, #accuracyChartSVG {
14   height: 300px;
15 }
16 </style>
17 </%block>
18
19 <%block name="js">
20 ${parent.js()}
21 <script src="/static/js/d3.v3.min.js"></script>
22 <script src="/static/js/nv.d3.min.js"></script>
23 <script src="/static/js/weaponCharts.js"></script>
24 <script type="text/javascript">
25 // tabs
26 $(function () {
27   $('#gbtab li').click(function(e) {
28     e.preventDefault();
29     $(this).tab('show');
30   })
31
32   $('#gbtab a:first').tab('show');
33 })
34
35 // weapon accuracy and damage charts
36 d3.json("${request.route_url('player_weaponstats_data_json', id=player.player_id)}", function(err, data) {
37   if(data.games.length < 5) {
38     d3.select(".row #damageChartRow").remove();
39     d3.select(".row #accuracyChartRow").remove();
40   }
41   drawDamageChart(data);
42   drawAccuracyChart(data);
43 });
44
45 % for g in games_played:
46 d3.select('.tab-${g.game_type_cd}').on("click", function() {
47   // have to remove the chart each time
48   d3.select('#damageChartSVG .nvd3').remove();
49   d3.select('#accuracyChartSVG .nvd3').remove();
50   d3.json("${request.route_url('player_weaponstats_data_json', id=player.player_id, _query={'limit':20, 'game_type':g.game_type_cd})}", function(err, data) {
51     drawDamageChart(data);
52     drawAccuracyChart(data);
53   });
54 });
55 % endfor
56
57 </script>
58 </%block>
59
60 <%block name="title">
61 Player Information
62 </%block>
63
64 <div class="row">
65   <div class="span12">
66     <h2>
67       ${player.nick_html_colors()|n}
68     </h2>
69     <h4>
70       <i><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">Joined ${player.joined_pretty_date()}</span> (player #${player.player_id})</i>
71       % if cake_day:
72       <img src="/static/images/icons/24x24/cake.png" title="Happy cake day!" />
73       % endif
74     </h4>
75   </div>
76 </div>
77
78 <div class="row">
79   <div id="gbtabcontainer" class="tabbable tabs-below">
80     <div class="tab-content">
81       % for g in games_played:
82       % if not g.game_type_cd in ['cq']:
83       <div class="tab-pane fade in 
84         % if g.game_type_cd == 'overall':
85         active
86         % endif
87         " id="tab-${g.game_type_cd}">
88         <div class="span5">
89           <p>
90           % if g.game_type_cd in overall_stats:
91           Last Played: <small><span class="abstime" data-epoch="${overall_stats[g.game_type_cd].last_played_epoch}" title="${overall_stats[g.game_type_cd].last_played.strftime('%a, %d %b %Y %H:%M:%S UTC')}"> ${overall_stats[g.game_type_cd].last_played_fuzzy} </span> <br /></small>
92           % else:
93           <small><br /></small>
94           % endif
95
96           Games Played: 
97           % if g.game_type_cd == 'overall':
98           <small><a href="${request.route_url("player_game_index", player_id=player.player_id)}" title="View recent games">
99           % else:
100           <small><a href="${request.route_url("player_game_index", player_id=player.player_id, _query={'type':g.game_type_cd})}" title="View recent ${overall_stats[g.game_type_cd].game_type_descr} games">
101           % endif
102           ${g.games}</a> <br /></small>
103
104           Playing Time: <small>${overall_stats[g.game_type_cd].total_playing_time} <br /></small>
105
106           % if g.game_type_cd in fav_maps:
107           Favorite Map: <small><a href="${request.route_url("map_info", id=fav_maps[g.game_type_cd].map_id)}" title="Go to the detail page for this map">${fav_maps[g.game_type_cd].map_name}</a> <br /></small>
108           % else:
109           <small><br /></small>
110           % endif
111
112           % if g.game_type_cd == 'ctf':
113           % if overall_stats[g.game_type_cd].total_captures is not None:
114           <small><a href="${request.route_url("player_captimes", id=player.player_id)}">Fastest flag captures...</a> <br /></small>
115           % else:
116           <small><br /></small>
117           % endif
118           % else:
119           <small><br /></small>
120           % endif
121
122           </p>
123         </div>
124         <div class="span5">
125           <p>
126           Win Percentage: <small>${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br /></small>
127
128           % if g.game_type_cd in overall_stats:
129           % if overall_stats[g.game_type_cd].k_d_ratio is not None:
130           Kill Ratio: <small>${round(overall_stats[g.game_type_cd].k_d_ratio,2)} (${overall_stats[g.game_type_cd].total_kills} kills, ${overall_stats[g.game_type_cd].total_deaths} deaths) <br /></small>
131           % endif
132           % else:
133           <small><br /></small>
134           % endif
135
136           % if g.game_type_cd in elos:
137           % if g.game_type_cd == 'overall':
138           Best Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].game_type_cd}, ${elos[g.game_type_cd].games} games) <br /></small>
139           % else:
140           Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games) <br /></small>
141           % endif
142           % else:
143           <small><br /></small>
144           % endif
145
146           % if g.game_type_cd in ranks:
147           % if g.game_type_cd == 'overall':
148           Best Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} (${ranks[g.game_type_cd].game_type_cd}, percentile: ${round(ranks[g.game_type_cd].percentile,2)}) <br /></small>
149           % else:
150           Rank: 
151           <small>
152             <a href="
153               % if ranks[g.game_type_cd].rank % 20 == 0:
154                 ${request.route_url('rank_index', game_type_cd=g.game_type_cd, _query={'page':ranks[g.game_type_cd].rank/20})}
155
156               % else:
157                 ${request.route_url('rank_index', game_type_cd=g.game_type_cd, _query={'page':ranks[g.game_type_cd].rank/20+1})}
158
159               % endif
160             " title="Player rank page for this player">
161             ${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank}</a>
162             (percentile: ${round(ranks[g.game_type_cd].percentile,2)})
163             <br />
164           </small>
165           % endif
166           % else:
167           <small><br /></small>
168           % endif
169
170           % if g.game_type_cd == 'ctf':
171           % if overall_stats[g.game_type_cd].cap_ratio is not None:
172           Cap Ratio: <small>${round(overall_stats[g.game_type_cd].cap_ratio,2)} (${overall_stats[g.game_type_cd].total_captures} captures, ${overall_stats[g.game_type_cd].total_pickups} pickups) <br /></small>
173           % else:
174           <small><br /></small>
175           % endif
176           % else:
177           <small><br /></small>
178           % endif
179           </p>
180         </div>
181       </div>
182       % endif
183       % endfor
184     </div>
185   </div>
186 </div>
187 <div class="row">
188   <div class="span12">
189     <ul id="gbtab" class="nav nav-tabs">
190       % for g in games_played:
191       <li class="tab-${g.game_type_cd}">
192       <a href="#tab-${g.game_type_cd}" data-toggle="tab" alt="${g.game_type_cd}" title="${overall_stats[g.game_type_cd].game_type_descr}">
193         <span class="sprite sprite-${g.game_type_cd}"> </span><br />
194         ${g.game_type_cd} <br />
195         <small>(${g.games})</small>
196       </a>
197       </li>
198       % endfor
199     </ul>
200   </div>
201 </div>
202
203
204 ##### Weapon Accuracy Chart ####
205 <div class="row" id="accuracyChartRow">
206   <div class="span12">
207     <h3>Weapon Accuracy</h3>
208     <noscript>
209       Sorry, but you've disabled JavaScript! It is required to draw the accuracy chart.
210     </noscript>
211     <div id="accuracyChart">
212       <svg id="accuracyChartSVG"></svg>
213     </div>
214   </div> <!-- end span12 -->
215 </div> <!-- end row -->
216
217
218 ##### Weapon Damage Chart ####
219 <div class="row" id="damageChartRow">
220   <div class="span12">
221     <h3>Weapon Damage</h3>
222     <noscript>
223       Sorry, but you've disabled JavaScript! It is required to draw the damage chart.
224     </noscript>
225     <div id="damageChart">
226       <svg id="damageChartSVG"></svg>
227     </div>
228   </div> <!-- end span12 -->
229 </div> <!-- end row -->
230
231
232
233 ##### RECENT GAMES (v2) ####
234 % if recent_games:
235 <div class="row">
236   <div class="span12">
237     <h3>Recent Games</h3>
238     <table class="table table-hover table-condensed">
239       <thead>
240         <tr>
241           <th></th>
242           <th>Type</th>
243           <th>Server</th>
244           <th>Map</th>
245           <th>Result</th>
246           <th>Played</th>
247           <th>Elo</th>
248         </tr>
249       </thead>
250       <tbody>
251       % for rg in recent_games:
252       <tr>
253         <td class="tdcenter"><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">view</a></td>
254         <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
255         <td><a href="${request.route_url('server_info', id=rg.server_id)}" title="Go to the detail page for this server">${rg.server_name}</a></td>
256         <td><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the detail page for this map">${rg.map_name}</a></td>
257         <td>
258           % if rg.team != None:
259           % if rg.team == rg.winner:
260           Win
261           % else:
262           Loss
263           % endif
264           % else:
265           % if rg.rank == 1:
266           Win
267           % else:
268           Loss (#${rg.rank})
269           % endif
270           % endif
271         </td>
272         <td><span class="abstime" data-epoch="${rg.epoch}" title="${rg.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></td>
273         <td class="tdcenter">
274           <a href="${request.route_url('game_info', id=rg.game_id, _query={'show_elo':1})}" title="View detailed information about this game">
275             % if rg.elo_delta is not None:
276             % if round(rg.elo_delta,2) > 0:
277             <span class="eloup" title="Elo went up by ${round(rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-up"></i></span>
278             % elif round(rg.elo_delta,2) < 0:
279             <span class="elodown" title="Elo went down by ${round(-rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-down"></i></span>
280             % else:
281             <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
282             % endif
283             % else:
284             <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
285             % endif
286           </a>
287         </td>
288       </tr>
289       % endfor
290       </tbody>
291     </table>
292     % if total_games > 10:
293     <p><a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.stripped_nick}">More...</a></p>
294     % endif
295   </div>
296 </div>
297 % endif