]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Add winners to the main page. highlight the team color of the winning team on hover.
authorAnt Zucaro <azucaro@gmail.com>
Thu, 3 Nov 2011 01:55:57 +0000 (21:55 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Thu, 3 Nov 2011 01:55:57 +0000 (21:55 -0400)
xonstat/static/css/style.css
xonstat/static/css/tables.css
xonstat/templates/main_index.mako
xonstat/views/main.py

index 2f8d960986597d9b83d5a4166f0842a4528742d9..ff25ef7b9615784c43d71931ed1c9eb23eedcfbd 100755 (executable)
@@ -81,6 +81,9 @@ td {
        padding:4px;
        vertical-align: middle;
 }
+td.gt_icon {
+    text-align: center;
+}
 blockquote {
        font-size:14px;
        color:#fff;
@@ -134,6 +137,10 @@ input { font-family: 'Xolonium', 'Arial', 'Helvetica'; }
        top:-48px;
        color:#DCE9F5;
 }
+.table_block {
+    float: left;
+    padding-right: 25px;
+}
 .window {
        border-width: 56px 56px 56px;
        -moz-border-image: url(img/web_border.png) 85 85 85 stretch;
@@ -363,7 +370,7 @@ input[type=text]:hover, .textbox:hover { background-position:-128px -32px; }
 }
 
 #recent-games {
-    width: 610px;
+    width: 950px;
 }
 #recent-games_filter {
        position: absolute;
index 6a5a2e3c2c661697980fb1498b816b08964aa9f8..08d7248ddb56d737162abeb7a6a7a3c0b3f6df84 100644 (file)
@@ -214,7 +214,6 @@ table.display tr.even.gradeU {
        background-color: #eee;
 }
 
-
 tr.odd {
        background-color: #000;
 }
@@ -223,6 +222,13 @@ tr.odd:hover {
        background-color: #222;
 }
 
+td.blue:hover {
+    background-color: #000F4C;
+}
+
+td.red:hover {
+    background-color: #571612;
+}
 
 tr.even {
        background-color: #111;
index f0190e0e32a130019c4ac448f6109efc96316bad..88fe8ca515e669beda135fff86126c2d370331eb 100755 (executable)
@@ -4,9 +4,60 @@
 Main Page - ${parent.title()}\r
 </%block>\r
 \r
-<div id="sidebar" class="leaderboard left">\r
+\r
+##### RECENT GAMES #####\r
+<h2>Recent Games</h2>\r
+<table id="recent-games">\r
+       <thead>\r
+               <tr>\r
+                       <th>Game #</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 href="${request.route_url('game_info', id=game.game_id)}" title="View detailed information about this game">${game.game_id}</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 class=\r
+            % if pgstat.team == 5:\r
+            "blue"\r
+            % elif pgstat.team == 14:\r
+            "red"\r
+            % elif pgstat.team == 13:\r
+            "yellow"\r
+            % endif\r
+            >\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()}</a></td>\r
+            % else:\r
+            ${pgstat.nick_html_colors()}</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
 \r
 ##### TOP PLAYERS #####\r
+<div class="table_block">\r
 <h2>Top Players</h2>\r
 <table id="top-players">\r
        <thead>\r
@@ -32,8 +83,10 @@ Main Page - ${parent.title()}
        % endfor\r
        </tbody>\r
 </table>\r
+</div>\r
 \r
 ##### TOP SERVERS #####\r
+<div class="table_block">\r
 <h2>Top Servers</h2>\r
 <table id="top-servers">\r
        <thead>\r
@@ -59,8 +112,10 @@ Main Page - ${parent.title()}
        % endfor\r
        </tbody>\r
 </table>\r
+</div>\r
 \r
 ##### TOP MAPS #####\r
+<div class="table_block">\r
 <h2>Top Maps</h2>\r
 <table id="top-maps">\r
        <thead>\r
@@ -86,45 +141,4 @@ Main Page - ${parent.title()}
        % endfor\r
        </tbody>\r
 </table>\r
-</div> <!-- END LEADERBOARD -->\r
-\r
-<div id="main" class="right">\r
-\r
-##### RECENT GAMES #####\r
-<h2>Recent Games</h2>\r
-<table id="recent-games">\r
-       <thead>\r
-               <tr>\r
-                       <th>Game #</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) in recent_games:\r
-               % if game != '-':\r
-               <tr>\r
-                       <td><a href="${request.route_url('game_info', id=game.game_id)}" title="View detailed information about this game">${game.game_id}</a></td>\r
-                       <td><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>${game.winner}</td>\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> <!-- END RECENT GAMES -->\r
+</div>\r
index 205c8686e7db439c588ec445821a4c14334760b8..1b36ad6b16dc589ccd397e9be76eb143e32eb2eb 100755 (executable)
@@ -18,7 +18,7 @@ def main_index(request):
         leaderboard_lifetime = 30
 
     leaderboard_count = 10
-    recent_games_count = 32
+    recent_games_count = 20
 
     # top players by score
     top_players = DBSession.query(Player.player_id, Player.nick, 
@@ -63,13 +63,16 @@ def main_index(request):
     for i in range(leaderboard_count-len(top_maps)):
         top_maps.append(('-', '-', '-'))
 
-    recent_games = DBSession.query(Game, Server, Map).\
+    # recent games played in descending order
+    recent_games = DBSession.query(Game, Server, Map, PlayerGameStat).\
             filter(Game.server_id==Server.server_id).\
             filter(Game.map_id==Map.map_id).\
+            filter(PlayerGameStat.game_id==Game.game_id).\
+            filter(PlayerGameStat.rank==1).\
             order_by(expr.desc(Game.start_dt)).all()[0:recent_games_count]
 
     for i in range(recent_games_count-len(recent_games)):
-        recent_games.append(('-', '-', '-'))
+        recent_games.append(('-', '-', '-', '-'))
 
     return {'top_players':top_players,
             'top_servers':top_servers,