]> git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/game_info.mako
Bundle in Luma.
[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="foundation">
11   <script>
12   $(document).foundation({
13       accordion: {
14         multi_expand: true,
15       }
16     });
17   </script>
18 </%block>
19
20 <%block name="title">
21   Game Information
22 </%block>
23
24
25 % if game is None:
26   <h2>Sorry, that game wasn't found!</h2>
27
28 % else:
29   <div class="row">
30
31     <div class="small-12 columns">
32       <h3>Game #${game.game_id}</h3>
33       <p>
34         <span class="sprite sprite-${game.game_type_cd}"></span> ${gametype.descr} <br />
35         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 />
36         Server: <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a><br />
37         Map: <a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a><br />
38         % if game.duration is not None:
39           Duration: ${"%s:%02d" % (game.duration.seconds/60, game.duration.seconds%60)}
40         % endif
41       </p>
42     </div>
43
44     % if teamscores:
45       <div class="small-3 columns">
46         <table class="table-condensed">
47           <thead>
48             <th>Team</th>
49             <th>Score</th>
50           </thead>
51           <tbody>
52             % for ts in teamscores:
53               <tr class="${ts.team}"><td>${ts.team.capitalize()}</td><td>${ts.score}</td></tr>
54             % endfor
55           </tbody>
56         </table>
57       </div>
58     % endif
59   </div>
60
61   ##### Games that have team scores push the scoreboard table to the right by
62   ##### one column. 
63   % if len(tgstats) == len(stats_by_team):
64     % for tgstat in tgstats:
65       <div class="row">
66
67         <div class="small-1 columns teamscore">
68           <div class="teamname ${tgstat.team_html_color()}">
69             ${tgstat.team_html_color().capitalize()}
70           </div>
71           <div class="${tgstat.team_html_color()}">
72             % if game.game_type_cd == 'ctf':
73               ${tgstat.caps}
74             % elif game.game_type_cd == 'ca':
75               ${tgstat.rounds}
76             % else:
77               ${tgstat.score}
78             % endif
79           </div>
80         </div>
81
82         <div class="small-12 medium-11 columns game">
83           ${scoreboard(game.game_type_cd, stats_by_team[tgstat.team], show_elo, show_latency)}
84         </div>
85       </div>
86     % endfor
87
88   ##### Games that do not have team scores use the full width
89   % else:
90     % for team in stats_by_team.keys():
91       <div class="row">
92         <div class="small-12 columns game">
93           ${scoreboard(game.game_type_cd, stats_by_team[team], show_elo, show_latency)}
94         </div>
95       </div>
96     % endfor
97   % endif
98
99   % if len(captimes) > 0:
100     <div class="row">
101       <div class="small-6 columns">
102         <h3>Best Flag Capture Times</h3>
103         <table class="table-hover table-condensed">
104           <thead>
105             <tr>
106               <th>Nick</th>
107               <th>Captime</th>
108             </tr>
109           </thead>
110           <tbody>
111           % for pgs in captimes:
112           <tr>
113             <td>
114               % if pgs.player_id > 2:
115               <a href="${request.route_url("player_info", id=pgs.player_id)}"
116                 title="Go to the info page for this player">
117                 <span class="nick">${pgs.nick_html_colors()|n}</span>
118               </a>
119               % else:
120               <span class="nick">${pgs.nick_html_colors()|n}</span>
121               % endif
122             </td>
123             <td>${round(float(pgs.fastest.seconds) + (pgs.fastest.microseconds/1000000.0), 2)}</td>
124           </tr>
125           % endfor
126           </tbody>
127         </table>
128       </div>
129     </div>
130   % endif
131
132   % if len(pgstats) > 0 and len(pwstats) > 0:
133     <div class="row">
134       <div class="small-12 medium-9 columns">
135           <ul class="accordion" data-accordion>
136             % for pgstat in pgstats:
137               % if pgstat.player_game_stat_id in pwstats:
138                 <li class="accordion-navigation">
139                   <a href="#accuracy-${pgstat.player_game_stat_id}">Accuracy for ${pgstat.nick_html_colors()|n}</a>
140                   <div id="accuracy-${pgstat.player_game_stat_id}" class="content">
141                     ${accuracy(pwstats[pgstat.player_game_stat_id])}
142                   </div>
143                 </li>
144               % endif
145             % endfor
146           </ul>
147         </div>
148       </div>
149   % endif
150 % endif