]> git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/templates/main_index.mako
Merge branch 'master' of http://git.xonotic.org/xonotic/xonstat into approved
[xonotic/xonstat.git] / xonstat / templates / main_index.mako
index 551eea4077287b75e5e642896e2541dc2859e5d6..74a9d5ffe28f21fe6866f287a16e93210c35e692 100644 (file)
@@ -4,52 +4,42 @@
 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>
+        % 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')}">${summary_stats.total_players}</a> players, <a href="${request.route_url('game_index')}">${summary_stats.total_games}</a> games (${summary_stats.duel_games} duel, ${summary_stats.ctf_games} ctf, ${summary_stats.dm_games} dm), and <a href="${request.route_url('server_index')}">${summary_stats.total_servers}</a> servers since October 2011.</p>
+        % endif
       </div>
 </%block>
 
+% if len(ranks) < 3:
 <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 -->
+% else:
+<div class="row">
+% for rs in ranks[:3]:
+  % if len(rs) > 0:
   <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 -->
 
-  <div class="span4">
-    ##### CTF RANKS #####
+    % 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>
+    % endif
+
     <table class="table table-bordered table-condensed">
       <thead>
         <tr>
@@ -60,61 +50,24 @@ Leaderboard
       </thead>
       <tbody>
       <% i = 1 %>
-      % for (player_id, nick, elo) in ctf_ranks:
+      % 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><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='ctf')}" title="See more CTF rankings">More...</a></p>
+    <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
 
-  <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:
-        <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='dm')}" title="See more deathmatch rankings">More...</a></p>
-  </div> <!-- /span4 -->
-</div> <!-- /row -->
 
 <div class="row">
   <div class="span4">
@@ -203,6 +156,7 @@ Leaderboard
   </div> <!-- /span4 -->
 </div> <!-- /row -->
 
+% if len(recent_games) > 0:
 <div class="row">
   <div class="span12">
     <h3>Recent Games</h3>
@@ -221,10 +175,11 @@ Leaderboard
       % for rg in recent_games:
         <tr>
           <td><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="gt_icon"><img title="${rg.game_type_cd}" src="/static/images/icons/24x24/${rg.game_type_cd}.png" alt="${rg.game_type_cd}" /></td>
+          <!-- <td class="gt_icon"><img title="${rg.game_type_cd}" src="/static/images/icons/24x24/${rg.game_type_cd}.png" alt="${rg.game_type_cd}" /></td> -->
+          <td><span class="sprite sprite-${rg.game_type_cd}" title="${rg.game_type_cd}"></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.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></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>
             % 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>
@@ -235,5 +190,7 @@ Leaderboard
         % endfor
         </tbody>
     </table>
+    <p><a href="${request.route_url('game_finder')}">More...</a></p>
   </div> <!-- /span12 -->
 </div> <!-- /row -->
+% endif