]> git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/templates/player_info.mako
Sprite-ify a few templates.
[xonotic/xonstat.git] / xonstat / templates / player_info.mako
index 8bb282fa0d44e77dc6228fea777bf40923075acf..2cb7a8f1a23694c3f411fa310f1bf5276c3aec05 100644 (file)
@@ -6,6 +6,11 @@
 ${nav.nav('players')}
 </%block>
 
+<%block name="css">
+    ${parent.css()}
+    <link href="/static/css/sprites.css" rel="stylesheet">
+</%block>
+
 <%block name="js">
     % if player is not None:
       <script src="/static/js/jquery-1.7.1.min.js"></script>
@@ -13,12 +18,12 @@ ${nav.nav('players')}
       <script src="/static/js/bootstrap-tab.js"></script>
       <script type="text/javascript">
       $(function () {
-        $('#gbtab').click(function(e) {
+        $('#gbtab li').click(function(e) {
             e.preventDefault();
             $(this).tab('show');
         })
 
-      $('#gbtab a:first').tab('show');
+        $('#gbtab a:first').tab('show');
       })
       </script>
 
@@ -194,13 +199,7 @@ Player Information
 </div>
 
 <div class="row">
-  <div id="gbtabcontainer" class="tabbable tabs-right">
-      <ul id="gbtab" class="nav nav-tabs">
-      % for g in games_played:
-        <li><a href="#tab-${g.game_type_cd}" data-toggle="tab">${g.game_type_cd} (${g.games})</a></li>
-      % endfor
-      </ul>
-
+  <div id="gbtabcontainer" class="tabbable tabs-below">
       <div class="tab-content">
       % for g in games_played:
         <div class="tab-pane fade in 
@@ -216,15 +215,17 @@ Player Information
 
             Games Played: <small>${g.games} <br /></small>
 
+            Playing Time: <small>${overall_stats[g.game_type_cd].total_playing_time} <br /></small>
+
             % if g.game_type_cd in fav_maps:
             Favorite Map: <small>${fav_maps[g.game_type_cd].map_name} <br /></small>
             % endif
-
-            Win Percentage: <small>${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br /></small>
             </p>
           </div>
           <div class="span5">
             <p>
+              Win Percentage: <small>${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br /></small>
+
             % if g.game_type_cd in overall_stats:
               % if overall_stats[g.game_type_cd].k_d_ratio is not None:
               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>
@@ -241,10 +242,10 @@ Player Information
 
             % if g.game_type_cd in ranks:
               % if g.game_type_cd == 'overall':
-              Best Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} (${ranks[g.game_type_cd].game_type_cd})<br /></small>
+              Best Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} (${ranks[g.game_type_cd].game_type_cd}, percentile: ${round(ranks[g.game_type_cd].percentile,2)})<br /></small>
 
               % else:
-              Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} <br /></small>
+              Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} (percentile: ${round(ranks[g.game_type_cd].percentile,2)})<br /></small>
               % endif
             % endif
 
@@ -260,6 +261,21 @@ Player Information
       </div>
   </div>
 </div>
+<div class="row">
+  <div class="span12">
+      <ul id="gbtab" class="nav nav-tabs">
+      % for g in games_played:
+        <li>
+          <a href="#tab-${g.game_type_cd}" data-toggle="tab">
+            <span class="sprite sprite-${g.game_type_cd}"> </span><br />
+            ${g.game_type_cd} <br />
+            <small>(${g.games})</small>
+          </a>
+        </li>
+      % endfor
+      </ul>
+  </div>
+</div>
 
 
 % if 'nex' in recent_weapons or 'rifle' in recent_weapons or 'minstanex' in recent_weapons or 'uzi' in recent_weapons or 'shotgun' in recent_weapons:
@@ -274,7 +290,7 @@ Player Information
         % if 'nex' in recent_weapons:
         <li>
           <div class="acc-weap weapon-active">
-            <img src="${request.static_url("xonstat:static/images/nex.png")}" />
+            <span class="sprite sprite-nex"></span>
             <p><small>Nex</small></p>
             <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'nex'})}" title="Show nex accuracy"></a>
           </div>
@@ -284,7 +300,7 @@ Player Information
         % if 'rifle' in recent_weapons:
         <li>
           <div class="acc-weap">
-            <img src="${request.static_url("xonstat:static/images/rifle.png")}" />
+            <span class="sprite sprite-rifle"></span>
             <p><small>Rifle</small></p>
             <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'rifle'})}" title="Show rifle accuracy"></a>
           </div>
@@ -294,7 +310,7 @@ Player Information
         % if 'minstanex' in recent_weapons:
         <li>
           <div class="acc-weap">
-            <img src="${request.static_url("xonstat:static/images/minstanex.png")}" />
+            <span class="sprite sprite-minstanex"></span>
             <p><small>Minstanex</small></p>
             <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'minstanex'})}" title="Show minstanex accuracy"></a>
           </div>
@@ -304,7 +320,7 @@ Player Information
         % if 'uzi' in recent_weapons:
         <li>
           <div class="acc-weap">
-            <img src="${request.static_url("xonstat:static/images/uzi.png")}" />
+            <span class="sprite sprite-uzi"></span>
             <p><small>Uzi</small></p>
             <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'uzi'})}" title="Show uzi accuracy"></a>
           </div>
@@ -314,7 +330,7 @@ Player Information
         % if 'shotgun' in recent_weapons:
         <li>
           <div class="acc-weap">
-            <img src="${request.static_url("xonstat:static/images/shotgun.png")}" />
+            <span class="sprite sprite-shotgun"></span>
             <p><small>Shotgun</small></p>
             <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'shotgun'})}" title="Show shotgun accuracy"></a>
           </div>
@@ -340,7 +356,7 @@ Player Information
         % if 'rocketlauncher' in recent_weapons:
         <li>
           <div class="dmg-weap weapon-active">
-            <img src="${request.static_url("xonstat:static/images/rocketlauncher.png")}" />
+            <span class="sprite sprite-rocketlauncher"></span>
             <p><small>Rocket</small></p>
             <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'rocketlauncher'})}" title="Show rocket launcher efficiency"></a>
           </div>
@@ -350,7 +366,7 @@ Player Information
         % if 'grenadelauncher' in recent_weapons:
         <li>
           <div class="dmg-weap">
-            <img src="${request.static_url("xonstat:static/images/grenadelauncher.png")}" />
+            <span class="sprite sprite-grenadelauncher"></span>
             <p><small>Mortar</small></p>
             <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'grenadelauncher'})}" title="Show mortar damage efficiency"></a>
           </div>
@@ -360,7 +376,7 @@ Player Information
         % if 'electro' in recent_weapons:
         <li>
           <div class="dmg-weap">
-            <img src="${request.static_url("xonstat:static/images/electro.png")}" />
+            <span class="sprite sprite-electro"></span>
             <p><small>Electro</small></p>
             <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'electro'})}" title="Show electro damage efficiency"></a>
           </div>
@@ -370,7 +386,7 @@ Player Information
         % if 'crylink' in recent_weapons:
         <li>
           <div class="dmg-weap">
-            <img src="${request.static_url("xonstat:static/images/crylink.png")}" />
+            <span class="sprite sprite-crylink"></span>
             <p><small>Crylink</small></p>
             <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'crylink'})}" title="Show crylink damage efficiency"></a>
           </div>
@@ -380,7 +396,7 @@ Player Information
         % if 'hagar' in recent_weapons:
         <li>
           <div class="dmg-weap">
-            <img src="${request.static_url("xonstat:static/images/hagar.png")}" />
+            <span class="sprite sprite-hagar"></span>
             <p><small>Hagar</small></p>
             <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'hagar'})}" title="Show hagar damage efficiency"></a>
           </div>
@@ -390,7 +406,7 @@ Player Information
         % if 'laser' in recent_weapons:
         <li>
           <div class="dmg-weap">
-            <img src="${request.static_url("xonstat:static/images/laser.png")}" />
+            <span class="sprite sprite-laser"></span>
             <p><small>Laser</small></p>
             <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'laser'})}" title="Show laser damage efficiency"></a>
           </div>
@@ -419,13 +435,14 @@ Player Information
            <th>Map</th>
            <th>Result</th>
            <th>Played</th>
+           <th>Elo</th>
         </tr>
       </thead>
       <tbody>
       % for (gamestat, game, server, map) in recent_games:
         <tr>
-           <td><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=game.game_id)}" title="View detailed information about this game">view</a></td>
-           <td style="width:20px;"><img title="${game.game_type_cd}" src="/static/images/icons/24x24/${game.game_type_cd}.png" alt="${game.game_type_cd}" /></td>
+           <td class="tdcenter"><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=game.game_id)}" title="View detailed information about this game">view</a></td>
+           <td class="tdcenter"><span class="sprite sprite-${game.game_type_cd}" alt="${game.game_type_cd}"></span></td>
            <td>${server.name}</td>
            <td>${map.name}</td>
            <td>
@@ -444,6 +461,21 @@ Player Information
           % endif
            </td>
            <td><span class="abstime" data-epoch="${game.epoch()}" title="${game.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${game.fuzzy_date()}</span></td>
+           <td class="tdcenter">
+             <a href="${request.route_url('game_info', id=game.game_id, _query={'show_elo':1})}" title="View detailed information about this game">
+               % if gamestat.elo_delta is not None:
+                 % if round(gamestat.elo_delta,2) > 0:
+                 <span title="Elo went up by ${round(gamestat.elo_delta,2)}"><i class="icon-arrow-up icon-white"></i></span>
+                 % elif round(gamestat.elo_delta,2) < 0:
+                 <span title="Elo went down by ${round(-gamestat.elo_delta,2)}"><i class="icon-arrow-down icon-white"></i></span>
+                 % else:
+                 <span title="Elo did not change"><i class="icon-minus icon-white"></i></span>
+                 % endif
+               % else:
+                 <span title="Elo did not change"><i class="icon-minus icon-white"></i></span>
+               % endif
+             </a>
+           </td>
         </tr>
       % endfor
       </tbody>