]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/templates/main_index.mako
Merge branch 'master' into zykure/approved
[xonotic/xonstat.git] / xonstat / templates / main_index.mako
index 3b9d4537974ec98684d8b0b741b7766862f6a144..f91b1c17858e77ccf01b9db0d1b7f7dc3a9144d8 100644 (file)
 Leaderboard
 </%block>
 
+<%block name="css">
+  ${parent.css()}
+  <link href="/static/css/sprites.css" rel="stylesheet">
+</%block>
+
 <%block name="hero_unit">
-      <div class="hero-unit">
-        <img src="/static/css/img/web_background_l2.png" />
-        #####<p id="statline">Tracking <a href="#">12345</a> players, <a href="#">12345</a> games (<a href="#">123</a> duels, <a href="#">123</a> ctfs, <a href="#">123</a> dms), <a href="#">12345</a> servers, and <a href="#">12345</a> maps since November 2011.</p>
-        <p id="statline">Tracking Xonotic statistics since October 2011.</p>
-        <p><a class="btn btn-primary btn-large" href="http://www.xonotic.org/download" title="Download Xonotic">Get the game &raquo;</a></p>
-      </div>
+  <div class="text-center">
+    <img src="/static/css/img/web_background_l2.png" />
+    % if summary_stats is None:
+    <p id="statline">Tracking Xonotic statistics since October 2011.</p>
+    % else:
+    <p id="statline">Tracking <a href="${request.route_url('player_index')}">${'{:2,d}'.format(summary_stats.total_players)}</a> players, <a href="${request.route_url('game_index')}">${'{:2,d}'.format(summary_stats.total_games)}</a> games (${'{:2,d}'.format(summary_stats.duel_games)} duel; ${'{:2,d}'.format(summary_stats.ctf_games)} ctf; ${'{:2,d}'.format(summary_stats.dm_games)} dm) and <a href="${request.route_url('server_index')}">${'{:2,d}'.format(summary_stats.total_servers)}</a> servers since October 2011.</p>
+    % endif
+  </div>
 </%block>
 
-<div class="row">
-  <div class="span4">
-    ##### DUEL RANKS #####
-    <h3>Duel Ranks</h3>
-    <table class="table table-bordered table-condensed">
-      <thead>
-        <tr>
-          <th>#</th>
-          <th>Nick</th>
-          <th>Elo</th>
-        </tr>
-      </thead>
-      <tbody>
-      <% i = 1 %>
-      % for (player_id, nick, elo) in duel_ranks:
-        <tr>
-          <td>${i}</td>
-          % if player_id != '-':
-          <td><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick|n}</a></td>
-          % else:
-          <td>${nick|n}</td>
-          % endif
-          % if elo != '-':
-          <td>${round(elo, 3)}</td>
-          % else:
-          <td>${elo}</td>
-          % endif
-        </tr>
-        <% i = i+1 %>
-      % endfor
-      </tbody>
-    </table>
-    <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='duel')}" title="See more duel rankings">More...</a></p>
-  </div> <!-- /span4 -->
+##### RANKS #####
+% if len(ranks) < 4:
+  <div class="row">
+    <div class="span12">
+      <p style="text-align: center;"><i class="icon-white icon-info-sign"> </i> You don't seem to have any ranks yet.</p>
+    </div> <!-- span12 -->
+  </div> <!-- row -->
 
-  <div class="span4">
-    ##### CTF RANKS #####
-    <h3>CTF Ranks</h3>
-    <table class="table table-bordered table-condensed">
-      <thead>
-        <tr>
-          <th>#</th>
-          <th>Nick</th>
-          <th>Elo</th>
-        </tr>
-      </thead>
-      <tbody>
-      <% i = 1 %>
-      % for (player_id, nick, elo) in ctf_ranks:
-        <tr>
-          <td>${i}</td>
-          % if player_id != '-':
-          <td><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick|n}</a></td>
-          % else:
-          <td>${nick|n}</td>
-          % endif
-          % if elo != '-':
-          <td>${round(elo, 3)}</td>
-          % else:
-          <td>${elo}</td>
-          % endif
-        </tr>
-        <% i = i+1 %>
-      % endfor
-      </tbody>
-    </table>
-    <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='ctf')}" title="See more CTF rankings">More...</a></p>
-  </div> <!-- /span4 -->
+% else:
+  <div class="row">
+    % for rs in ranks[:4]:
+    % if len(rs) > 0:
+    <div class="span3">
+      % if rs[0].game_type_cd == 'duel':
+      <h3>Duel Ranks</h3>
+      % elif rs[0].game_type_cd == 'ctf':
+      <h3>CTF Ranks</h3>
+      % elif rs[0].game_type_cd == 'dm':
+      <h3>DM Ranks</h3>
+      % elif rs[0].game_type_cd == 'tdm':
+      <h3>TDM Ranks</h3>
+      % endif
 
-  <div class="span4">
-    ##### DM RANKS #####
-    <h3>DM Ranks</h3>
-    <table class="table table-bordered table-condensed">
-      <thead>
-        <tr>
-          <th>#</th>
-          <th>Nick</th>
-          <th>Elo</th>
-        </tr>
-      </thead>
-      <tbody>
-      <% i = 1 %>
-      % for (player_id, nick, elo) in dm_ranks:
+      <table class="table table-hover table-condensed">
+        <thead>
+          <tr>
+            <th>#</th>
+            <th>Nick</th>
+            <th>Elo</th>
+          </tr>
+        </thead>
+        <tbody>
+        <% i = 1 %>
+        % for r in rs:
         <tr>
           <td>${i}</td>
-          % if player_id != '-':
-          <td><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick|n}</a></td>
-          % else:
-          <td>${nick|n}</td>
-          % endif
-          % if elo != '-':
-          <td>${round(elo, 3)}</td>
-          % else:
-          <td>${elo}</td>
-          % endif
+          <td class="player-nick"><a href="${request.route_url('player_info', id=r.player_id)}" title="Go to the player info page for this player">${r.nick_html_colors()|n}</a></td>
+          <td>${round(r.elo, 3)}</td>
         </tr>
         <% i = i+1 %>
-      % endfor
-    </tbody>
-  </table>
-  <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='dm')}" title="See more deathmatch rankings">More...</a></p>
-  </div> <!-- /span4 -->
-</div> <!-- /row -->
+        % endfor
+        </tbody>
+      </table>
+      <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd=rs[0].game_type_cd)}" title="See more ${rs[0].game_type_cd} rankings">More...</a></p>
+    </div> <!-- /span4 -->
+  % endif
+
+  % endfor
+</div> <!-- row -->
+% endif
 
+
+##### ACTIVE PLAYERS #####
 <div class="row">
   <div class="span4">
     <h3>Most Active Players</h3>
-    <table class="table table-bordered table-condensed">
+    <table class="table table-hover table-condensed">
       <thead>
         <tr>
           <th>#</th>
@@ -134,7 +90,7 @@ Leaderboard
         <tr>
           <td>${i}</td>
           % if player_id != '-':
-          <td><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick|n}</a></td>
+          <td class="player-nick"><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick|n}</a></td>
           % else:
           <td>${nick|n}</td>
           % endif
@@ -147,9 +103,11 @@ Leaderboard
     <p class="note">*Most active stats are from the past 7 days</p>
   </div> <!-- /span4 -->
 
+
+##### ACTIVE SERVERS #####
   <div class="span4">
     <h3>Most Active Servers</h3>
-    <table class="table table-bordered table-condensed">
+    <table class="table table-hover table-condensed">
       <thead>
         <tr>
           <th>#</th>
@@ -175,9 +133,11 @@ Leaderboard
     </table>
   </div> <!-- /span4 -->
 
+
+##### ACTIVE MAPS #####
   <div class="span4">
     <h3>Most Active Maps</h3>
-    <table class="table table-bordered table-condensed">
+    <table class="table table-hover table-condensed">
       <thead>
         <tr>
           <th>#</th>
@@ -204,10 +164,13 @@ Leaderboard
   </div> <!-- /span4 -->
 </div> <!-- /row -->
 
+
+##### RECENT GAMES #####
+% if len(recent_games) > 0:
 <div class="row">
   <div class="span12">
     <h3>Recent Games</h3>
-    <table class="table table-bordered table-condensed">
+    <table class="table table-hover table-condensed">
       <thead>
         <tr>
           <th></th>
@@ -219,33 +182,24 @@ Leaderboard
         </tr>
       </thead>
       <tbody>
-      % for (game, server, map, pgstat) in recent_games:
-        % if game != '-':
+      % for rg 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 class="gt_icon"><img title="${game.game_type_cd}" src="/static/images/icons/24x24/${game.game_type_cd}.png" alt="${game.game_type_cd}" /></td>
-          <td><a href="${request.route_url('server_info', id=server.server_id)}" title="Go to the detail page for this server">${server.name}</a></td>
-          <td><a href="${request.route_url('map_info', id=map.map_id)}" title="Go to the map detail page for this map">${map.name}</a></td>
-          <td><span title="${game.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${game.fuzzy_date()}</span></td>
-          <td>
-            % if pgstat.player_id > 2:
-            <a href="${request.route_url('player_info', id=pgstat.player_id)}" title="Go to the player info page for this player">${pgstat.nick_html_colors()|n}</a></td>
+          <td class="tdcenter"><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">view</a></td>
+          <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
+          <td><a href="${request.route_url('server_info', id=rg.server_id)}" title="Go to the detail page for this server">${rg.server_name}</a></td>
+          <td><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the map detail page for this map">${rg.map_name}</a></td>
+          <td><span class="abstime" data-epoch="${rg.epoch}" title="${rg.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></td>
+          <td class="player-nick">
+            % if rg.player_id > 2:
+            <a href="${request.route_url('player_info', id=rg.player_id)}" title="Go to the player info page for this player">${rg.nick_html_colors|n}</a></td>
             % else:
-            ${pgstat.nick_html_colors()|n}</td>
+            ${rg.nick_html_colors|n}</td>
             % endif
         </tr>
-        % else:
-        <tr>
-          <td>-</td>
-          <td>-</td>
-          <td>-</td>
-          <td>-</td>
-          <td>-</td>
-          <td>-</td>
-        </tr>
-        % endif
         % endfor
         </tbody>
     </table>
+    <p><a href="${request.route_url('game_finder')}">More...</a></p>
   </div> <!-- /span12 -->
 </div> <!-- /row -->
+% endif