]> git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Add html_colors support to player model. Use it in player templates!
authorAnt Zucaro <azucaro@gmail.com>
Sun, 22 May 2011 14:20:04 +0000 (10:20 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 22 May 2011 14:20:04 +0000 (10:20 -0400)
xonstat/models.py
xonstat/templates/player_game_index.mako
xonstat/templates/player_info.mako

index 317e004dd8eda7c498b264ada958b3f1d4faab73..e75ccde87a5297cb176c62742615c3deaaa6cb14 100644 (file)
@@ -10,6 +10,10 @@ Base = declarative_base()
 
 # define objects for all tables
 class Player(object):
+
+    def nick_html_colors(self):
+        return html_colors(self.nick)
+
     def __repr__(self):
         return "<Player(%s, %s, %s, %s)>" % (self.player_id, self.nick, 
                 self.create_dt, self.location)
index 7b23bf2017844866d7903abe09d76bab731a0a8f..308fe435b9f389add26a7edd170db5e7607d8a4c 100755 (executable)
@@ -1,14 +1,14 @@
 <%inherit file="base.mako"/>
 
 <%block name="title">
-Player Game Index for ${player.nick} - ${parent.title()}
+Player Game Index for ${player.nick_html_colors()} - ${parent.title()}
 </%block>
 
 % if not games:
 <h2>Sorry, no games yet. Get playing, scrub!</h2>
 
 % else:
-<h2>Recent Games by ${player.nick}</h2>
+<h2>Recent Games by ${player.nick_html_colors()}</h2>
 <ul>
 % for (playergamestat, game, server, map) in games:
    <li><a href="${request.route_url("game_info", id=game.game_id)}" name="Game info page for game #${game.game_id}">#${game.game_id}:</a> <a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a></li>
index 7d046f458fa19a793883f2cd713c2c28746e5622..561da175b40ab27a36b437fd46f513984b253937 100755 (executable)
@@ -2,7 +2,7 @@
 
 <%block name="title">
 % if player:
-Player Information for ${player.nick} - 
+Player Information for ${player.nick_html_colors()} - 
 % endif
 
 ${parent.title()}
@@ -14,7 +14,7 @@ ${parent.title()}
 <p>Seriously though, he probably doesn't exist...just a figment of your imagination. Carry on then!</p>
 
 % else:
-<h2>${player.nick}</h2>
+<h2>${player.nick_html_colors()}</h2>
 <p>
    Joined: ${player.create_dt.strftime('%m/%d/%Y at %I:%M %p')} <br />
 </p>
@@ -27,5 +27,5 @@ ${parent.title()}
    <li><a href="${request.route_url("game_info", id=game.game_id)}" name="Game info page for game #${game.game_id}">#${game.game_id}:</a> <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></li>
 % endfor
 </ul>
-<a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.nick}">More games</a> played by ${player.nick}...
+<a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.nick}">More games</a> played by ${player.nick_html_colors()}...
 % endif