Support teamscores on the xonstat webpage (game_info view)
[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   <h2>Game Detail</h2>
36   <div class="span6 game-detail">
37     <img width="64" height="64" src="/static/images/icons/48x48/${game.game_type_cd}.png" alt="${game.game_type_cd}"/>
38     <p>
39     Played: <span class="abstime" data-epoch="${game.epoch()}" title="${game.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${game.fuzzy_date()}</span><br />
40     Game Type: ${gametype.descr} (${game.game_type_cd})<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     <span class="clear"></span>
48   </div>
49   % if teamscores:
50   <div class="span3 teamscores">
51     <table class="table 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 <div class="row">
67   <div class="span12 game">
68     <h3>Scoreboard</h3>
69     ${scoreboard(game.game_type_cd, pgstats, show_elo, show_latency)}
70   </div>
71 </div>
72
73 % if len(captimes) > 0:
74 <div class="row">
75   <div class="span6">
76     <h3>Best Flag Capture Times</h3>
77     <table class="table table-hover table-condensed">
78       <thead>
79         <tr>
80           <th>Nick</th>
81           <th>Captime</th>
82         </tr>
83       </thead>
84       <tbody>
85       % for pgs in captimes:
86       <tr>
87         <td>
88           % if pgs.player_id > 2:
89           <a href="${request.route_url("player_info", id=pgs.player_id)}"
90             title="Go to the info page for this player">
91             <span class="nick">${pgs.nick_html_colors()|n}</span>
92           </a>
93           % else:
94           <span class="nick">${pgs.nick_html_colors()|n}</span>
95           % endif
96         </td>
97         <td>${round(float(pgs.fastest.seconds) + (pgs.fastest.microseconds/1000000.0), 2)}</td>
98       </tr>
99       % endfor
100       </tbody>
101     </table>
102   </div>
103 </div>
104 % endif
105
106
107 % if len(pgstats) > 0 and len(pwstats) > 0:
108 <div class="row">
109   <div class="span12">
110     <h3>Accuracy Information</h3>
111     <div class="accordion" id="acc-accordion" style="display:none;">
112       % for pgstat in pgstats:
113       % if pgstat.player_game_stat_id in pwstats:
114       <div class="accordion-group">
115         <div class="accordion-heading">
116           <a class="accordion-toggle" data-toggle="collapse" data-parent="#acc-accordion" href="#accuracy-${pgstat.player_game_stat_id}">
117             Accuracy for ${pgstat.nick_html_colors()|n}
118           </a>
119         </div>
120         <div id="accuracy-${pgstat.player_game_stat_id}" class="accordion-body collapse in">
121           <div class="accordion-inner">
122             ${accuracy(pwstats[pgstat.player_game_stat_id])}
123           </div>
124         </div>
125       </div>
126       % endif
127       % endfor
128     </div>
129   </div>
130   % endif
131
132 </div>
133 % endif