]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/templates/main_index.mako
Add a hover message to the 'time' column.
[xonotic/xonstat.git] / xonstat / templates / main_index.mako
old mode 100755 (executable)
new mode 100644 (file)
index f5b8abd..321b8e1
-<%inherit file="base.mako"/>\r
-\r
-<%block name="title">\r
-Leaderboard\r
-</%block>\r
-\r
-<%block name="hero_unit">\r
-      <div class="hero-unit">\r
-        <img src="/static/css/img/web_background_l2.png" />\r
-        #####<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>\r
-        <p id="statline">Tracking Xonotic statistics since October 2011.</p>\r
-        <p><a class="btn btn-primary btn-large" href="http://www.xonotic.org/download" title="Download Xonotic">Get the game &raquo;</a></p>\r
-      </div>\r
-</%block>\r
-\r
-<div class="row">\r
-  <div class="span4">\r
-    ##### DUEL RANKS #####\r
-    <h3>Duel Ranks</h3>\r
-    <table class="table table-bordered table-condensed">\r
-      <thead>\r
-        <tr>\r
-          <th>#</th>\r
-          <th>Nick</th>\r
-          <th>Elo</th>\r
-        </tr>\r
-      </thead>\r
-      <tbody>\r
-      <% i = 1 %>\r
-      % for (player_id, nick, elo) in duel_ranks:\r
-        <tr>\r
-          <td>${i}</td>\r
-          % if player_id != '-':\r
-          <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>\r
-          % else:\r
-          <td>${nick|n}</td>\r
-          % endif\r
-          % if elo != '-':\r
-          <td>${round(elo, 3)}</td>\r
-          % else:\r
-          <td>${elo}</td>\r
-          % endif\r
-        </tr>\r
-        <% i = i+1 %>\r
-      % endfor\r
-      </tbody>\r
-    </table>\r
-    <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='duel')}" title="See more duel rankings">More...</a></p>\r
-  </div> <!-- /span4 -->\r
-\r
-  <div class="span4">\r
-    ##### CTF RANKS #####\r
-    <h3>CTF Ranks</h3>\r
-    <table class="table table-bordered table-condensed">\r
-      <thead>\r
-        <tr>\r
-          <th>#</th>\r
-          <th>Nick</th>\r
-          <th>Elo</th>\r
-        </tr>\r
-      </thead>\r
-      <tbody>\r
-      <% i = 1 %>\r
-      % for (player_id, nick, elo) in ctf_ranks:\r
-        <tr>\r
-          <td>${i}</td>\r
-          % if player_id != '-':\r
-          <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>\r
-          % else:\r
-          <td>${nick|n}</td>\r
-          % endif\r
-          % if elo != '-':\r
-          <td>${round(elo, 3)}</td>\r
-          % else:\r
-          <td>${elo}</td>\r
-          % endif\r
-        </tr>\r
-        <% i = i+1 %>\r
-      % endfor\r
-      </tbody>\r
-    </table>\r
-    <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='ctf')}" title="See more CTF rankings">More...</a></p>\r
-  </div> <!-- /span4 -->\r
-\r
-  <div class="span4">\r
-    ##### DM RANKS #####\r
-    <h3>DM Ranks</h3>\r
-    <table class="table table-bordered table-condensed">\r
-      <thead>\r
-        <tr>\r
-          <th>#</th>\r
-          <th>Nick</th>\r
-          <th>Elo</th>\r
-        </tr>\r
-      </thead>\r
-      <tbody>\r
-      <% i = 1 %>\r
-      % for (player_id, nick, elo) in dm_ranks:\r
-        <tr>\r
-          <td>${i}</td>\r
-          % if player_id != '-':\r
-          <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>\r
-          % else:\r
-          <td>${nick|n}</td>\r
-          % endif\r
-          % if elo != '-':\r
-          <td>${round(elo, 3)}</td>\r
-          % else:\r
-          <td>${elo}</td>\r
-          % endif\r
-        </tr>\r
-        <% i = i+1 %>\r
-      % endfor\r
-    </tbody>\r
-  </table>\r
-  <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='dm')}" title="See more deathmatch rankings">More...</a></p>\r
-  </div> <!-- /span4 -->\r
-</div> <!-- /row -->\r
-\r
-<div class="row">\r
-  <div class="span4">\r
-    <h3>Most Active Players</h3>\r
-    <table class="table table-bordered table-condensed">\r
-      <thead>\r
-        <tr>\r
-          <th>#</th>\r
-          <th>Nick</th>\r
-          <th class="play-time">Play Time</th>\r
-        </tr>\r
-      </thead>\r
-      <tbody>\r
-      <% i = 1 %>\r
-      % for (player_id, nick, alivetime) in top_players:\r
-        <tr>\r
-          <td>${i}</td>\r
-          % if player_id != '-':\r
-          <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>\r
-          % else:\r
-          <td>${nick|n}</td>\r
-          % endif\r
-          <td class="play-time">${alivetime}</td>\r
-        </tr>\r
-        <% i = i+1 %>\r
-      % endfor\r
-      </tbody>\r
-    </table>\r
-    <p class="note">*Most active stats are from the past 7 days</p>\r
-  </div> <!-- /span4 -->\r
-\r
-  <div class="span4">\r
-    <h3>Most Active Servers</h3>\r
-    <table class="table table-bordered table-condensed">\r
-      <thead>\r
-        <tr>\r
-          <th>#</th>\r
-          <th>Server</th>\r
-          <th>Games</th>\r
-        </tr>\r
-      </thead>\r
-      <tbody>\r
-      <% i = 1 %>\r
-      % for (server_id, name, count) in top_servers:\r
-        <tr>\r
-          <td>${i}</td>\r
-          % if server_id != '-':\r
-          <td><a href="${request.route_url('server_info', id=server_id)}" title="Go to the server info page for ${name}">${name}</a></td>\r
-          % else:\r
-          <td>${name}</td>\r
-          % endif\r
-          <td>${count}</td>\r
-        </tr>\r
-        <% i = i+1 %>\r
-      % endfor\r
-      </tbody>\r
-    </table>\r
-  </div> <!-- /span4 -->\r
-\r
-  <div class="span4">\r
-    <h3>Most Active Maps</h3>\r
-    <table class="table table-bordered table-condensed">\r
-      <thead>\r
-        <tr>\r
-          <th>#</th>\r
-          <th>Map</th>\r
-          <th>Games</th>\r
-        </tr>\r
-      </thead>\r
-      <tbody>\r
-      <% i = 1 %>\r
-      % for (map_id, name, count) in top_maps:\r
-        <tr>\r
-          <td>${i}</td>\r
-          % if map_id != '-':\r
-          <td><a href="${request.route_url('map_info', id=map_id)}" title="Go to the map info page for ${name}">${name}</a></td>\r
-          % else:\r
-          <td>${name}</td>\r
-          % endif\r
-          <td>${count}</td>\r
-        </tr>\r
-        <% i = i+1 %>\r
-      % endfor\r
-      </tbody>\r
-    </table>\r
-  </div> <!-- /span4 -->\r
-</div> <!-- /row -->\r
-\r
-<div class="row">\r
-  <div class="span12">\r
-    <h3>Recent Games</h3>\r
-    <table class="table table-bordered table-condensed">\r
-      <thead>\r
-        <tr>\r
-          <th></th>\r
-          <th>Type</th>\r
-          <th>Server</th>\r
-          <th>Map</th>\r
-          <th>Time</th>\r
-          <th>Winner</th>\r
-        </tr>\r
-      </thead>\r
-      <tbody>\r
-      % for (game, server, map, pgstat) in recent_games:\r
-        % if game != '-':\r
-        <tr>\r
-          <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>\r
-          <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>\r
-          <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>\r
-          <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>\r
-          <td>${game.start_dt.strftime('%m/%d/%Y %H:%M')}</td>\r
-          <td>\r
-            % if pgstat.player_id > 2:\r
-            <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>\r
-            % else:\r
-            ${pgstat.nick_html_colors()|n}</td>\r
-            % endif\r
-        </tr>\r
-        % else:\r
-        <tr>\r
-          <td>-</td>\r
-          <td>-</td>\r
-          <td>-</td>\r
-          <td>-</td>\r
-          <td>-</td>\r
-          <td>-</td>\r
-        </tr>\r
-        % endif\r
-        % endfor\r
-        </tbody>\r
-    </table>\r
-  </div> <!-- /span12 -->\r
-</div> <!-- /row -->\r
+<%inherit file="base.mako"/>
+
+<%block name="title">
+  Leaderboard
+</%block>
+
+<%block name="hero_unit">
+  <div class="text-center">
+    <img src="/static/css/img/xonotic-logo.png" />
+    % if stat_line is None:
+      <p class="statline">Tracking Xonotic statistics since October 2011.</p>
+    % else:
+      <p class="statline">Tracking ${stat_line|n} since October 2011.</p>
+    % endif
+
+    % if day_stat_line is not None:
+      <p class="statline">${day_stat_line|n} in the past 24 hours.</p>
+    % endif
+  </div>
+</%block>
+
+##### RANKS #####
+% if len(ranks) < 4:
+  <div class="row">
+    <div class="small-12 large-12 columns">
+      <p class="text-center"><i class="icon-white icon-info-sign"> </i> You don't seem to have any ranks yet.</p>
+    </div>
+  </div>
+
+% else:
+  <div class="row">
+    % for rs in ranks[:4]:
+      % if len(rs) > 0:
+        <div class="small-12 large-3 columns">
+          % if rs[0].game_type_cd == 'duel':
+            <h5>Duel Ranks <a href="${request.route_url('rank_index', game_type_cd=rs[0].game_type_cd)}" title="See more ${rs[0].game_type_cd} rankings"><i class="fa fa-plus-circle"></i></a></h5>
+          % elif rs[0].game_type_cd == 'ctf':
+            <h5>CTF Ranks <a href="${request.route_url('rank_index', game_type_cd=rs[0].game_type_cd)}" title="See more ${rs[0].game_type_cd} rankings"><i class="fa fa-plus-circle"></i></a></h5>
+          % elif rs[0].game_type_cd == 'dm':
+            <h5>DM Ranks <a href="${request.route_url('rank_index', game_type_cd=rs[0].game_type_cd)}" title="See more ${rs[0].game_type_cd} rankings"><i class="fa fa-plus-circle"></i></a></h5>
+          % elif rs[0].game_type_cd == 'tdm':
+            <h5>TDM Ranks <a href="${request.route_url('rank_index', game_type_cd=rs[0].game_type_cd)}" title="See more ${rs[0].game_type_cd} rankings"><i class="fa fa-plus-circle"></i></a></h5>
+          % endif
+
+          <table class="table-hover table-condensed">
+            <thead>
+              <tr>
+                <th class="small-2">#</th>
+                <th class="small-7">Nick</th>
+                <th class="small-3">Elo</th>
+              </tr>
+            </thead>
+            <tbody>
+            <% i = 1 %>
+            % for r in rs:
+            <tr>
+              <td>${i}</td>
+              <td class="no-stretch"><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>${int(round(r.elo))}</td>
+            </tr>
+            <% i = i+1 %>
+            % endfor
+            </tbody>
+          </table>
+    </div>
+  % endif
+
+  % endfor
+</div>
+% endif
+
+
+##### ACTIVE PLAYERS #####
+<div class="row">
+  <div class="small-12 large-4 columns">
+    <h5>Most Active Players <a href="${request.route_url('top_players_index')}" title="See more player activity"><i class="fa fa-plus-circle"></i></a></h5>
+      <table class="table table-hover table-condensed">
+        <thead>
+          <tr>
+            <th class="small-2">#</th>
+            <th class="small-7">Nick</th>
+            <th class="small-3">Time</th>
+          </tr>
+        </thead>
+        <tbody>
+        % for tp in top_players:
+          <tr>
+            <td>${tp.sort_order}</td>
+            <td class="no-stretch"><a href="${request.route_url('player_info', id=tp.player_id)}" title="Go to the player info page for this player">${tp.nick_html_colors()|n}</a></td>
+            <td>${tp.alivetime}</td>
+          </tr>
+        % endfor
+        </tbody>
+      </table>
+  </div>
+
+
+##### ACTIVE SERVERS #####
+  <div class="small-12 large-4 columns">
+    <h5>Most Active Servers <a href="${request.route_url('top_servers_index')}" title="See more server activity"><i class="fa fa-plus-circle"></i></a></h5>
+    <table class="table table-hover table-condensed">
+      <thead>
+        <tr>
+          <th class="small-2">#</th>
+          <th class="small-7">Server</th>
+          <th class="small-3" title="Total accumulated player time on the server">Time</th>
+        </tr>
+      </thead>
+      <tbody>
+      % for ts in top_servers:
+        <tr>
+          <td>${ts.sort_order}</td>
+          <td class="no-stretch"><a href="${request.route_url('server_info', id=ts.server_id)}" title="Go to the server info page for ${ts.server_name}">${ts.server_name}</a></td>
+          <td>${ts.play_time_str(max_segments=2)}</td>
+        </tr>
+      % endfor
+      </tbody>
+    </table>
+  </div>
+
+
+##### ACTIVE MAPS #####
+  <div class="small-12 large-4 columns">
+    <h5>Most Active Maps <a href="${request.route_url('top_maps_index')}" title="See more map activity"><i class="fa fa-plus-circle"></i></a></h5>
+    <table class="table table-hover table-condensed">
+      <thead>
+        <tr>
+          <th class="small-2">#</th>
+          <th class="small-7">Map</th>
+          <th class="small-3">Games</th>
+        </tr>
+      </thead>
+      <tbody>
+      % for tm in top_maps:
+        <tr>
+          <td>${tm.sort_order}</td>
+          <td class="no-stretch"><a href="${request.route_url('map_info', id=tm.map_id)}" title="Go to the map info page for ${tm.map_name}">${tm.map_name}</a></td>
+          <td>${tm.games}</td>
+        </tr>
+      % endfor
+      </tbody>
+    </table>
+  </div>
+</div>
+
+<div class="row">
+  <div class="small-12 columns">
+    <small>*Most active stats are from the past 7 days</small>
+  </div>
+</div>
+
+
+##### RECENT GAMES #####
+% if len(recent_games) > 0:
+<div class="row">
+  <div class="small-12 columns">
+    <h5>Recent Games <a href="${request.route_url('game_index')}"><i class="fa fa-plus-circle"></i></a></h5>
+    <table class="table table-hover table-condensed">
+      <thead>
+        <tr>
+          <th class="small-1 text-center"></th>
+          <th class="small-1">Type</th>
+          <th class="show-for-medium-up small-3">Server</th>
+          <th class="show-for-medium-up small-2">Map</th>
+          <th class="show-for-large-up small-2">Time</th>
+          <th class="small-3">Winner</th>
+        </tr>
+      </thead>
+      <tbody>
+      % for rg in recent_games:
+        <tr>
+          <td class="text-center"><a class="button tiny" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">view</a></td>
+          <td class="text-center"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
+          <td class="show-for-medium-up no-stretch"><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 class="show-for-medium-up"><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 class="show-for-large-up"><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="no-stretch">
+            % 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:
+            ${rg.nick_html_colors|n}</td>
+            % endif
+        </tr>
+        % endfor
+        </tbody>
+    </table>
+  </div>
+</div>
+% endif