]> git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Add team color support
authorAnt Zucaro <azucaro@gmail.com>
Mon, 23 May 2011 17:39:39 +0000 (13:39 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Mon, 23 May 2011 17:39:39 +0000 (13:39 -0400)
xonstat/models.py [changed mode: 0644->0755]
xonstat/templates/game_index.mako

old mode 100644 (file)
new mode 100755 (executable)
index e75ccde..0e68b5c
@@ -87,6 +87,16 @@ class PlayerGameStat(object):
     def nick_html_colors(self):
         return html_colors(self.nick)
 
+    def team_html_color(self):
+        if self.team == 5:
+            return "#0000FF"
+        if self.team == 14:
+            return "#FF0000"
+        if self.team == 13:
+            return "#FFFF00"
+        if self.team == 10:
+            return "#FF00FF"
+
 
 class GameMutator(object):
     def __repr__(self):
index 8024184cec826ab4bc7b281116ad1aee28340eb1..883865ece1539b12067b11328121fa2b902140b8 100755 (executable)
@@ -13,7 +13,7 @@ Game Index - ${parent.title()}
 <p>\r
    <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> (<a href="${request.route_url('game_info', id=game.game_id)}" name="Permalink for game #${game.game_id}">permalink</a> for this game)\r
 <table border="1" cellpadding="3">\r
-    % if game.game_type_cd == 'ctf':\r
+% if game.game_type_cd == 'ctf':\r
     <tr>\r
         <td>Nick</td>\r
         <td>Team</td>\r
@@ -38,7 +38,7 @@ Game Index - ${parent.title()}
           ${pgstat.nick_html_colors()}\r
         % endif\r
         </td>\r
-        <td>${pgstat.team}</td>\r
+        <td style="background-color:${pgstat.team_html_color()};"></td>\r
         <td>${pgstat.kills}</td>\r
         <td>${pgstat.captures}</td>\r
         <td>${pgstat.pickups}</td>\r