]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/templates/game_info.mako
Merge branch 'master' into zykure/wip
[xonotic/xonstat.git] / xonstat / templates / game_info.mako
index 1c7d58093e23a986daf007aecba82184c005bd19..b9ab8765282b5385401386b7272deb5443e4a377 100644 (file)
@@ -1,7 +1,29 @@
 <%inherit file="base.mako"/>
+<%namespace name="nav" file="nav.mako" />
+<%namespace file="scoreboard.mako" import="scoreboard" />
+<%namespace file="accuracy.mako" import="accuracy" />
+
+<%block name="navigation">
+${nav.nav('games')}
+</%block>
+
+<%block name="css">
+${parent.css()}
+<link href="/static/css/sprites.css" rel="stylesheet">
+</%block>
+
+<%block name="js">
+${parent.js()}
+<script>
+$(".collapse").collapse();
+
+// show accordion only when loaded to prevent rollup from being seen
+$("#acc-accordion").css('display', '');
+</script>
+</%block>
 
 <%block name="title">
-Game Information - ${parent.title()}
+Game Information
 </%block>
 
 
@@ -9,76 +31,130 @@ Game Information - ${parent.title()}
 <h2>Sorry, that game wasn't found!</h2>
 
 % else:
-<h2>Game Detail</h2>
-<p>
-Played on: ${start_dt.strftime('%m/%d/%Y at %I:%M %p')}<br />
-Game Type: ${game_type_cd}<br />
-Server: <a href="${request.route_url("server_info", id=server_id)}" name="Server info page for ${server_name}">${server_name}</a><br />
-Map: <a href="${request.route_url("map_info", id=map_id)}" name="Map info page for ${map_name}">${map_name}</a><br />
-</p>
+<div class="row">
+  <h2>Game Detail</h2>
+  <div class="span8 game-detail">
+    <img width="64" height="64" src="/static/images/icons/48x48/${game.game_type_cd}.png" alt="${game.game_type_cd}"/>
+    <p>
+    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 />
+    Game Type: ${gametype.descr} (${game.game_type_cd})<br />
+    Server: <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a><br />
+    Map: <a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a><br />
+    % if game.duration is not None:
+    Duration: ${"%s:%02d" % (game.duration.seconds/60, game.duration.seconds%60)}
+    % endif
+    </p>
+    <span class="clear"></span>
+  </div>
+  % if teamscores:
+  <div class="span3 teamscores">
+    <table class="table table-condensed">
+    <thead>
+      <th>Team</th>
+      <th>Score</th>
+    </thead>
+    <tbody>
+    % for ts in teamscores:
+      <tr class="${ts.team}"><td>${ts.team.capitalize()}</td><td>${ts.score}</td></tr>
+    % endfor
+    </tbody>
+    </table>
+  </div>
+  % endif
+</div>
 
-<h2>Scoreboard</h2>
-<table border="1" cellpadding="3">
-% if game_type_cd == 'ctf':
-    <tr>
-        <td>Nick</td>
-        <td>Kills</td>
-        <td>Captures</td>
-        <td>Pickups</td>
-        <td>Flag Carrier Kills</td>
-        <td>Returns</td>
-        <td>Score</td>
-        <td>Accuracy</td>
-    </tr>
+% if len(tgstats) == len(stats_by_team):
+## if we have teamscores in the db
+% for tgstat in tgstats:
+<div class="row">
+  <div class="span1 teamscore">
+  <div class="teamname ${tgstat.team_html_color()}">
+  ${tgstat.team_html_color().capitalize()}
+  </div>
+  <div class="${tgstat.team_html_color()}">
+  % if game.game_type_cd == 'ctf':
+  ${tgstat.caps}
+  % elif game.game_type_cd == 'ca':
+  ${tgstat.rounds}
+## dom -> ticks, rc -> laps, nb -> goals, as -> objectives
+  % else:
+  ${tgstat.score}
+  % endif
+  </div>
+  </div>
+  <div class="span10 game">
+  ${scoreboard(game.game_type_cd, stats_by_team[tgstat.team], show_elo, show_latency)}
+  </div>
+</div>
+% endfor
+% else:
+% for team in stats_by_team.keys():
+<div class="row">
+  <div class="span12 game">
+  ${scoreboard(game.game_type_cd, stats_by_team[team], show_elo, show_latency)}
+  </div>
+</div>
+% endfor
+% endif
 
-% for player_game_stat in player_game_stats:
-    <tr>
+% if len(captimes) > 0:
+<div class="row">
+  <div class="span6">
+    <h3>Best Flag Capture Times</h3>
+    <table class="table table-hover table-condensed">
+      <thead>
+        <tr>
+          <th>Nick</th>
+          <th>Captime</th>
+        </tr>
+      </thead>
+      <tbody>
+      % for pgs in captimes:
+      <tr>
         <td>
-        % if player_game_stat.player_id > 2:
-          <a href="${request.route_url("player_info", id=player_game_stat.player_id)}"
-           title="Go to the info page for this player">
-          ${player_game_stat.nick_html_colors()}
+          % if pgs.player_id > 2:
+          <a href="${request.route_url("player_info", id=pgs.player_id)}"
+            title="Go to the info page for this player">
+            <span class="nick">${pgs.nick_html_colors()|n}</span>
           </a>
-        % else:
-          ${player_game_stat.nick_html_colors()}
-        % endif
+          % else:
+          <span class="nick">${pgs.nick_html_colors()|n}</span>
+          % endif
         </td>
-        <td>${player_game_stat.kills}</td>
-        <td>${player_game_stat.captures}</td>
-        <td>${player_game_stat.pickups}</td>
-        <td>${player_game_stat.carrier_frags}</td>
-        <td>${player_game_stat.returns}</td>
-        <td>${player_game_stat.score}</td>
-        <td>
-        % if player_game_stat.player_id > 1:
-          <a href="${request.route_url("player_weapon_stats", game_id=player_game_stat.game_id, pgstat_id=player_game_stat.player_game_stat_id)}"
-           title="View weapon accuracy details for this player in this game">
-          View
-          </a>
-        % endif
-        </td>
-    </tr>
-% endfor
+        <td>${round(float(pgs.fastest.seconds) + (pgs.fastest.microseconds/1000000.0), 2)}</td>
+      </tr>
+      % endfor
+      </tbody>
+    </table>
+  </div>
+</div>
 % endif
 
-% if game_type_cd == 'dm':
-    <tr>
-        <td>Nick</td>
-        <td>Kills</td>
-        <td>Deaths</td>
-        <td>Suicides</td>
-        <td>Score</td>
-    </tr>
 
-% for player_game_stat in player_game_stats:
-    <tr>
-        <td>${player_game_stat.nick_html_colors()}</td>
-        <td>${player_game_stat.kills}</td>
-        <td>${player_game_stat.deaths}</td>
-        <td>${player_game_stat.suicides}</td>
-        <td>${player_game_stat.score}</td>
-    </tr>
-% endfor
-% endif
-</table>
+% if len(pgstats) > 0 and len(pwstats) > 0:
+<div class="row">
+  <div class="span12">
+    <h3>Accuracy Information</h3>
+    <div class="accordion" id="acc-accordion" style="display:none;">
+      % for pgstat in pgstats:
+      % if pgstat.player_game_stat_id in pwstats:
+      <div class="accordion-group">
+        <div class="accordion-heading">
+          <a class="accordion-toggle" data-toggle="collapse" data-parent="#acc-accordion" href="#accuracy-${pgstat.player_game_stat_id}">
+            Accuracy for ${pgstat.nick_html_colors()|n}
+          </a>
+        </div>
+        <div id="accuracy-${pgstat.player_game_stat_id}" class="accordion-body collapse in">
+          <div class="accordion-inner">
+            ${accuracy(pwstats[pgstat.player_game_stat_id])}
+          </div>
+        </div>
+      </div>
+      % endif
+      % endfor
+    </div>
+  </div>
+  % endif
+
+</div>
 % endif