]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Add non-breaking tables to map_info/server_info; fix map_captimes
authorJan Behrens <zykure@web.de>
Thu, 18 Apr 2013 22:29:21 +0000 (00:29 +0200)
committerJan Behrens <zykure@web.de>
Thu, 18 Apr 2013 22:29:21 +0000 (00:29 +0200)
xonstat/templates/map_captimes.mako
xonstat/templates/map_info.mako
xonstat/templates/server_info.mako
xonstat/views/map.py

index 55ebc1eb80044d3b8cde85b6ee437f77c999c9c0..4fc0ec59a53558cf77a81e28bc43a8c5c17a445e 100644 (file)
@@ -12,7 +12,7 @@ Map captimes
     <h2>${map.name}</h2>
     <p><a href="${map_url}">Back to map info page</a></p>
 
-    <h3>Fastest flag capture times:</h3>
+    <h3>Fastest Flag Captures:</h3>
 
     <table class="table table-bordered table-condensed">
       <thead>
@@ -30,8 +30,8 @@ Map captimes
           <td class="tdcenter"><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=ct.game_id)}" title="View detailed information about this game">view</a></td>
           <td>${ct.fastest_cap.total_seconds()} seconds</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>
+            % if ct.player_id > 2:
+            <a href="${request.route_url('player_info', id=ct.player_id)}" title="Go to the player info page for this player">${ct.player_nick_html|n}</a>
             % else:
             ${rg.nick_html_colors|n}
             % endif
@@ -44,3 +44,4 @@ Map captimes
 
   </div>
 </div>
+
index 9e872b5a3776898589c1cef5080b36429e85b0a9..1c817ea06c36f93652f4889bd9abef2f39b34556 100644 (file)
@@ -33,9 +33,9 @@ ${parent.title()}
     <table class="table table-hover table-condensed">
       <thead>
         <tr>
-          <th>#</th>
-          <th>Nick</th>
-          <th>Score</th>
+          <th style="width:40px;">#</th>
+          <th style="width:150px;">Nick</th>
+          <th style="width:90px;">Score</th>
         </tr>
       </thead>
       <tbody>
@@ -44,9 +44,9 @@ ${parent.title()}
         <tr>
           <td>${i}</td>
           % if score_player_id != '-':
-          <td><a href="${request.route_url('player_info', id=score_player_id)}" title="Go to the player info page for this player">${score_nick|n}</a></td>
+          <td class="nostretch" style="max-width:150px;"><a href="${request.route_url('player_info', id=score_player_id)}" title="Go to the player info page for this player">${score_nick|n}</a></td>
           % else:
-          <td>${score_nick}</td>
+          <td class="nostretch" style="max-width:150px;">${score_nick}</td>
           % endif
           <td>${score_value}</td>
         </tr>
@@ -54,7 +54,6 @@ ${parent.title()}
         % endfor
         </tbody>
     </table>
-    <p class="note">*Most active stats are from the past 7 days</p>
   </div>
 
 
@@ -63,9 +62,9 @@ ${parent.title()}
   <table class="table table-hover table-condensed">
     <thead>
       <tr>
-        <th>#</th>
-        <th>Nick</th>
-        <th>Playing Time</th>
+        <th style="width:40px;">#</th>
+        <th style="width:150px;">Nick</th>
+        <th style="width:90px;">Playing Time</th>
       </tr>
     </thead>
     <tbody>
@@ -74,9 +73,9 @@ ${parent.title()}
       <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="nostretch" style="max-width:150px;"><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}</td>
+        <td class="nostretch" style="max-width:150px;">${nick}</td>
         % endif
         <td>${alivetime}</td>
       </tr>
@@ -92,9 +91,9 @@ ${parent.title()}
   <table class="table table-hover table-condensed">
     <thead>
       <tr>
-        <th>#</th>
-        <th>Name</th>
-        <th>Times Played</th>
+        <th style="width:40px;">#</th>
+        <th style="width:150px;">Name</th>
+        <th style="width:90px;"># Games</th>
       </tr>
     </thead>
     <tbody>
@@ -102,7 +101,7 @@ ${parent.title()}
     % for (server_id, name, times_played) in top_servers:
       <tr>
         <td>${i}</td>
-        <td><a href="${request.route_url('server_info', id=server_id)}" title="Go to the server info page for this server">${name}</a></td>
+        <td class="nostretch" style="max-width:150px;"><a href="${request.route_url('server_info', id=server_id)}" title="Go to the server info page for this server">${name}</a></td>
         <td>${times_played}</td>
       </tr>
       <% i = i+1 %>
@@ -112,6 +111,12 @@ ${parent.title()}
 </div>
 </div> <!-- /row -->
 
+<div class="row">
+  <div class="span12">
+    <p class="note">*Most active stats are from the past 7 days</p>
+  </div>
+</div>
+
 % if len(captimes) > 0:
 <div class="row">
   <div class="span6">
index 5c2cf73d4f770d18562ae447a4d0d7e164af9876..3bb1adc98ca1c30627ab65eaefdd839365d50997 100644 (file)
@@ -38,9 +38,9 @@ Server Information
       <table class="table table-hover table-condensed">
         <thead>
           <tr>
-            <th>#</th>
-            <th>Nick</th>
-            <th>Score</th>
+            <th style="width:40px;">#</th>
+            <th style="width:150px;">Nick</th>
+            <th style="width:90px;">Score</th>
           </tr>
         </thead>
         <tbody>
@@ -49,9 +49,9 @@ Server Information
           <tr>
             <td>${i}</td>
             % if score_player_id != '-':
-            <td><a href="${request.route_url('player_info', id=score_player_id)}" title="Go to the player info page for this player">${score_nick|n}</a></td>
+            <td class="nostretch" style="max-width:150px;"><a href="${request.route_url('player_info', id=score_player_id)}" title="Go to the player info page for this player">${score_nick|n}</a></td>
             % else:
-            <td>${score_nick}</td>
+            <td class="nostretch" style="max-width:150px;">${score_nick}</td>
             % endif
             <td>${score_value}</td>
           </tr>
@@ -68,9 +68,9 @@ Server Information
     <table class="table table-hover table-condensed">
       <thead>
         <tr>
-          <th>#</th>
-          <th>Nick</th>
-          <th>Playing Time</th>
+          <th style="width:40px;">#</th>
+          <th style="width:150px;">Nick</th>
+          <th style="width:90px;">Playing Time</th>
         </tr>
       </thead>
       <tbody>
@@ -79,9 +79,9 @@ Server Information
         <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="nostretch" style="max-width:150px;"><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}</td>
+          <td class="nostretch" style="max-width:150px;">${nick}</td>
           % endif
           <td>${alivetime}</td>
         </tr>
@@ -97,9 +97,9 @@ Server Information
     <table class="table table-hover table-condensed">
       <thead>
         <tr>
-          <th>#</th>
-          <th>Map</th>
-          <th># Games</th>
+          <th style="width:40px;">#</th>
+          <th style="width:150px;">Map</th>
+          <th style="width:120px;"># Games</th>
         </tr>
       </thead>
       <tbody>
@@ -108,9 +108,9 @@ Server Information
         <tr>
           <td>${i}</td>
           % if map_id != '-':
-          <td><a href="${request.route_url('map_info', id=map_id)}" title="Go to the map info page for ${name}">${name}</a></td>
+          <td class="nostretch" style="max-width:150px;"><a href="${request.route_url('map_info', id=map_id)}" title="Go to the map info page for ${name}">${name}</a></td>
           % else:
-          <td>${name}</td>
+          <td class="nostretch" style="max-width:150px;">${name}</td>
           % endif
           <td>${count}</td>
         </tr>
index cd6f80fb4e849784057f75eb5f0dc1f617e33b22..004f22a37f788078d3471d6bb00e9f4282d4516b 100644 (file)
@@ -166,7 +166,7 @@ def map_info_json(request):
 
 def map_captimes_data(request):
     map_id = int(request.matchdict['id'])
-
+        
     MapCaptimes = namedtuple('PlayerCaptimes', ['fastest_cap', 'create_dt', 'create_dt_epoch', 'create_dt_fuzzy',
         'player_id', 'player_nick', 'player_nick_stripped', 'player_nick_html',
         'game_id', 'server_id', 'server_name'])
@@ -193,6 +193,7 @@ def map_captimes_data(request):
                   "AND  pgs.player_id = ct.player_id "
                   "AND  pgs.game_id = ct.game_id "
                 "ORDER  BY ct.fastest_cap "
+                "LIMIT  25"
             ).params(map_id=map_id).all()
 
     mmap = DBSession.query(Map).filter_by(map_id=map_id).one()