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