]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/game_info.mako
Progress on the game info page.
[xonotic/xonstat.git] / xonstat / templates / game_info.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3 <%namespace file="scoreboard.mako" import="scoreboard" />
4 <%namespace file="accuracy.mako" import="accuracy" />
5
6 <%block name="navigation">
7   ${nav.nav('games')}
8 </%block>
9
10 <%block name="css">
11   ${parent.css()}
12   <link href="/static/css/sprites.css" rel="stylesheet">
13 </%block>
14
15 <%block name="js">
16   ${parent.js()}
17   <script>
18   $(".collapse").collapse();
19
20   // show accordion only when loaded to prevent rollup from being seen
21   $("#acc-accordion").css('display', '');
22   </script>
23 </%block>
24
25 <%block name="title">
26   Game Information
27 </%block>
28
29
30 % if game is None:
31   <h2>Sorry, that game wasn't found!</h2>
32
33 % else:
34   <div class="row">
35
36     <div class="small-12 columns">
37       <h3>Game #${game.game_id}</h3>
38       <p>
39         <img src="/static/images/icons/24x24/${game.game_type_cd}.png" alt="${game.game_type_cd}"/> ${gametype.descr} (${game.game_type_cd})<br />
40         Played ${game.fuzzy_date()} <span class="abstime" data-epoch="${game.epoch()}" title="${game.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}"> <i class="fa fa-info-circle"></i></span><br />
41         Server: <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a><br />
42         Map: <a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a><br />
43         % if game.duration is not None:
44           Duration: ${"%s:%02d" % (game.duration.seconds/60, game.duration.seconds%60)}
45         % endif
46       </p>
47     </div>
48
49     % if teamscores:
50       <div class="small-3 columns">
51         <table class="table-condensed">
52           <thead>
53             <th>Team</th>
54             <th>Score</th>
55           </thead>
56           <tbody>
57             % for ts in teamscores:
58               <tr class="${ts.team}"><td>${ts.team.capitalize()}</td><td>${ts.score}</td></tr>
59             % endfor
60           </tbody>
61         </table>
62       </div>
63     % endif
64   </div>
65
66   ##### Games that have team scores push the scoreboard table to the right by
67   ##### one column. 
68   % if len(tgstats) == len(stats_by_team):
69     % for tgstat in tgstats:
70       <div class="row">
71
72         <div class="small-1 columns teamscore">
73           <div class="teamname ${tgstat.team_html_color()}">
74             ${tgstat.team_html_color().capitalize()}
75           </div>
76           <div class="${tgstat.team_html_color()}">
77             % if game.game_type_cd == 'ctf':
78               ${tgstat.caps}
79             % elif game.game_type_cd == 'ca':
80               ${tgstat.rounds}
81             % else:
82               ${tgstat.score}
83             % endif
84           </div>
85         </div>
86
87         <div class="small-11 columns game">
88           ${scoreboard(game.game_type_cd, stats_by_team[tgstat.team], show_elo, show_latency)}
89         </div>
90       </div>
91     % endfor
92
93   ##### Games that do not have team scores use the full width
94   % else:
95     % for team in stats_by_team.keys():
96       <div class="row">
97         <div class="small-12 columns game">
98           ${scoreboard(game.game_type_cd, stats_by_team[team], show_elo, show_latency)}
99         </div>
100       </div>
101     % endfor
102   % endif
103
104   % if len(captimes) > 0:
105   <div class="row">
106     <div class="small-6 columns">
107       <h3>Best Flag Capture Times</h3>
108       <table class="table-hover table-condensed">
109         <thead>
110           <tr>
111             <th>Nick</th>
112             <th>Captime</th>
113           </tr>
114         </thead>
115         <tbody>
116         % for pgs in captimes:
117         <tr>
118           <td>
119             % if pgs.player_id > 2:
120             <a href="${request.route_url("player_info", id=pgs.player_id)}"
121               title="Go to the info page for this player">
122               <span class="nick">${pgs.nick_html_colors()|n}</span>
123             </a>
124             % else:
125             <span class="nick">${pgs.nick_html_colors()|n}</span>
126             % endif
127           </td>
128           <td>${round(float(pgs.fastest.seconds) + (pgs.fastest.microseconds/1000000.0), 2)}</td>
129         </tr>
130         % endfor
131         </tbody>
132       </table>
133     </div>
134   </div>
135 % endif
136
137 % if len(pgstats) > 0 and len(pwstats) > 0:
138   <div class="row">
139     <div class="small-12 columns">
140       <h3>Accuracy Information</h3>
141       <div class="accordion" id="acc-accordion" style="display:none;">
142         % for pgstat in pgstats:
143           % if pgstat.player_game_stat_id in pwstats:
144             <div class="accordion-group">
145               <div class="accordion-heading">
146                 <a class="accordion-toggle" data-toggle="collapse" data-parent="#acc-accordion" href="#accuracy-${pgstat.player_game_stat_id}">
147                   Accuracy for ${pgstat.nick_html_colors()|n}
148                 </a>
149               </div>
150               <div id="accuracy-${pgstat.player_game_stat_id}" class="accordion-body collapse in">
151                 <div class="accordion-inner">
152                   ${accuracy(pwstats[pgstat.player_game_stat_id])}
153                 </div>
154               </div>
155             </div>
156           % endif
157         % endfor
158       </div>
159     </div>
160     % endif
161   </div>
162 % endif