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