]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Use gametype description for icon tooltips (e.g. ca -> Clan Arena)
authorJan Behrens <zykure@web.de>
Mon, 4 Feb 2013 21:37:31 +0000 (22:37 +0100)
committerJan Behrens <zykure@web.de>
Mon, 4 Feb 2013 21:37:31 +0000 (22:37 +0100)
xonstat/static/css/style.css
xonstat/templates/game_index.mako
xonstat/templates/game_info.mako
xonstat/templates/main_index.mako
xonstat/templates/map_info.mako
xonstat/templates/player_info.mako
xonstat/templates/server_info.mako
xonstat/views/game.py
xonstat/views/helpers.py

index a7e2cb8d0a74277d40f8df27ced7c79798c9685e..7a7c6b12f3ecc37e90803bdbfce5eafee0de39fe 100755 (executable)
@@ -3525,13 +3525,21 @@ header h2 { display:none; }
 
 .table .tdcenter { text-align: center; }
 
-/* Game Info */
+/* Game Info and Game Index*/
 .game-detail img {
   float: left;
   margin-right: 10px;
+  margin-bottom: 5px;
+}
+
+.game img {
+  float: left;
+  margin-right: 5px;
+  margin-bottom: 5px;
 }
 
-.game-detail p {
+.game-detail p,
+.game h4 {
   float: left;
 }
 
index a8f17232307a304595f7e6ef30123b3ea7fda3c6..0e8a037092706fb76facb75236eeb739b752e00e 100644 (file)
@@ -18,9 +18,11 @@ Game Index
 <div class="row">
   <div class="span12">
     <h2>Recent Games</h2>
-    % for (game, server, map) in games:
+    % for (game, server, map, gametype) in games:
     <div class="game">
-      <h4><img src="/static/images/icons/48x48/${game.game_type_cd}.png" width="30" height="30" /><a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a> on <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a> <span class="permalink">(<a href="${request.route_url('game_info', id=game.game_id)}" name="Permalink for game #${game.game_id}">permalink</a>)</span></h4>
+      <img src="/static/images/icons/48x48/${game.game_type_cd}.png" width="30" height="30" alt="${game.game_type_cd}" title="${gametype.descr}"/>
+      <h4><a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a> on <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a> <span class="permalink">(<a href="${request.route_url('game_info', id=game.game_id)}" name="Permalink for game #${game.game_id}">permalink</a>)</span></h4>
+      <span class="clear"></span>
       ${scoreboard(game.game_type_cd, pgstats[game.game_id])}
     </div>
     % endfor
index 841e3d9219967b56aa3b8bd898b0eff6ee2badb3..7e7e80e47d97c0eeb27b8b2defbd39f3b7f76fc9 100644 (file)
@@ -34,10 +34,10 @@ Game Information
 <div class="row">
   <div class="span10 game-detail">
     <h2>Game Detail</h2>
-    <img width="48" height="48" src="/static/images/icons/48x48/${game.game_type_cd}.png" alt="${game.game_type_cd}" title="${game.game_type_cd}"/>
+    <img width="48" height="48" src="/static/images/icons/48x48/${game.game_type_cd}.png" alt="${game.game_type_cd}"/>
     <p>
       Played: <span class="abstime" data-epoch="${game.epoch()}" title="${game.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${game.fuzzy_date()}</span><br />
-      Game Type: ${game.game_type_cd}<br />
+      Game Type: ${game.game_type_cd} (${gametype.descr})<br />
       Server: <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a><br />
       Map: <a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a><br />
       % if game.duration is not None:
index 74a9d5ffe28f21fe6866f287a16e93210c35e692..f1dd2b14c3bd90e659f90352069015bd59d1dc55 100644 (file)
@@ -176,7 +176,7 @@ Leaderboard
         <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><span class="sprite sprite-${rg.game_type_cd}" title="${rg.game_type_cd}"></span></td>
+          <td><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>
index abbd4b0a80906f9b17ca609b232f32e11b6adde6..ad2348aa1bd958bc22b78410376c1e4543807f3f 100644 (file)
@@ -168,7 +168,7 @@ ${parent.title()}
         % 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><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}"></span></td>
+          <td><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><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>
index f08e7c3c0db3a4ce57b203faddee5063b9ed32a9..4c7e740a29539b61aab34116a903e501782c49d0 100644 (file)
@@ -442,7 +442,7 @@ Player Information
       % for rg in recent_games:
         <tr>
            <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}"></span></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>${rg.server_name}</td>
            <td>${rg.map_name}</td>
            <td>
index fef79a419c5fd05af3bc595b4d74fd1d03b7652a..ef57cf450c42aefdc760cb27254f6169d838ffd0 100644 (file)
@@ -141,7 +141,7 @@ Server Information
         % 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><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}"></span></td>
+          <td><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('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>
index 4c4800de990386f995187820be5142e0999adb21..822604f7f93003b29675dd8404d3cd64bd9ae557 100644 (file)
@@ -18,15 +18,16 @@ def _game_index_data(request):
     else:
         current_page = 1
 
-    games_q = DBSession.query(Game, Server, Map).\
+    games_q = DBSession.query(Game, Server, Map, GameType).\
             filter(Game.server_id == Server.server_id).\
             filter(Game.map_id == Map.map_id).\
+            filter(Game.game_type_cd == GameType.game_type_cd).\
             order_by(Game.game_id.desc())
 
     games = Page(games_q, current_page, items_per_page=10, url=page_url)
 
     pgstats = {}
-    for (game, server, map) in games:
+    for (game, server, map, gametype) in games:
         pgstats[game.game_id] = DBSession.query(PlayerGameStat).\
                 filter(PlayerGameStat.game_id == game.game_id).\
                 order_by(PlayerGameStat.scoreboardpos).\
@@ -70,10 +71,11 @@ def _game_info_data(request):
     try:
         notfound = False
 
-        (game, server, map) = DBSession.query(Game, Server, Map).\
+        (game, server, map, gametype) = DBSession.query(Game, Server, Map, GameType).\
                 filter(Game.game_id == game_id).\
                 filter(Game.server_id == Server.server_id).\
-                filter(Game.map_id == Map.map_id).one()
+                filter(Game.map_id == Map.map_id).\
+                filter(Game.game_type_cd == GameType.game_type_cd).one()
 
         pgstats = DBSession.query(PlayerGameStat).\
                 filter(PlayerGameStat.game_id == game_id).\
@@ -113,6 +115,7 @@ def _game_info_data(request):
         game = None
         server = None
         map = None
+        gametype = None
         pgstats = None
         pwstats = None
         captimes = None
@@ -123,6 +126,7 @@ def _game_info_data(request):
     return {'game':game,
             'server':server,
             'map':map,
+            'gametype':gametype,
             'pgstats':pgstats,
             'pwstats':pwstats,
             'captimes':captimes,
index 3e09e08db265bec6c254e7c836c56e456fe6a6fa..cbaed249074a6ecd951d6761841ed86193e7ffb7 100644 (file)
@@ -16,8 +16,9 @@ class RecentGame(object):
     The constructor takes a query row that has been fetched, and
     it requires the following columns to be present in the row:
 
-        game_id, game_type_cd, winner, start_dt, server_id, server_name,
-        map_id, map_name, player_id, nick, rank, team
+        game_id, game_type_cd, game_type_descr, winner, start_dt,
+        server_id, server_name, map_id, map_name, player_id, nick,
+        rank, team
 
     The following columns are optional:
 
@@ -29,6 +30,7 @@ class RecentGame(object):
     def __init__(self, row):
         self.game_id = row.game_id
         self.game_type_cd = row.game_type_cd
+        self.game_type_descr = row.game_type_descr
         self.winner = row.winner
         self.start_dt = row.start_dt
         self.fuzzy_date = pretty_date(row.start_dt)
@@ -52,6 +54,7 @@ class RecentGame(object):
         return {
             "game_id": self.game_id,
             "game_type_cd": self.game_type_cd,
+            "game_type_descr": self.game_type_descr,
             "winner": self.winner,
             "start_dt": self.start_dt,
             "fuzzy_dt": self.fuzzy_date,
@@ -82,15 +85,16 @@ def recent_games_q(server_id=None, map_id=None, player_id=None, cutoff=None):
     look when querying. Only games that happened on or after the
     cutoff (which is a datetime object) will be returned.
     '''
-    recent_games_q = DBSession.query(Game.game_id, Game.game_type_cd,
-            Game.winner, Game.start_dt, Server.server_id,
-            Server.name.label('server_name'), Map.map_id,
+    recent_games_q = DBSession.query(Game.game_id, GameType.game_type_cd,
+            Game.winner, Game.start_dt, GameType.descr.label('game_type_descr'),
+            Server.server_id, Server.name.label('server_name'), Map.map_id,
             Map.name.label('map_name'), PlayerGameStat.player_id,
             PlayerGameStat.nick, PlayerGameStat.rank, PlayerGameStat.team,
             PlayerGameStat.elo_delta).\
             filter(Game.server_id==Server.server_id).\
             filter(Game.map_id==Map.map_id).\
             filter(Game.game_id==PlayerGameStat.game_id).\
+            filter(Game.game_type_cd==GameType.game_type_cd).\
             order_by(expr.desc(Game.game_id))
 
     # the various filters provided get tacked on to the query