<%namespace file="scoreboard.mako" import="scoreboard" />
<%namespace file="navlinks.mako" import="navlinks" />
+<%block name="css">
+${parent.css()}
+<link href="/static/css/sprites.css" rel="stylesheet">
+</%block>
+
<%block name="navigation">
${nav.nav('games')}
</%block>
</%block>
% if not games:
+ % if not game_type_cd:
<h2>Sorry, no games yet. Get playing!</h2>
+ % else:
+<h2>Sorry, no ${game_type_cd.upper()} games yet. Get playing!</h2>
+ % endif
% else:
<div class="row">
- <div class="span10 offset1">
+ <div class="span12">
% if not game_type_cd:
<h2>Recent Games</h2>
% else:
<h2>Recent ${game_type_cd.upper()} Games</h2>
% endif
+ </div>
+</div>
+<div class="row">
+ <div class="span12 tabbable">
+ <ul class="nav nav-tabs">
+ % for gt in ('overall','duel','ctf','dm','tdm','ca','kh','ft','lms','as','dom','nb','cts','rc'):
+ ##% for gt in ('overall','duel','ctf','dm','tdm','ca','kh','ft','lms','as','dom','nb','cts','rc'):
+ <li>
+ % if gt == 'overall':
+ <a href="${request.route_url("game_index")}" alt="${gt}" title="" data-toggle="none">
+ % else:
+ <a href="${request.route_url("game_index_filtered", game_type_cd=gt)}" alt="${gt}" title="" data-toggle="none">
+ % endif
+ <span class="sprite sprite-${gt}"> </span><br />
+ ${gt} <br />
+ </a>
+ </li>
+ % endfor
+ </ul>
+ </div>
+ <div class="span12 offset1 tab-content">
% for rg in games.items:
<div class="game">
<img src="/static/images/icons/48x48/${rg.game_type_cd}.png" width="30" height="30" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"/>
<%namespace name="nav" file="nav.mako" />
<%namespace file="navlinks.mako" import="navlinks" />
+<%block name="css">
+${parent.css()}
+<link href="/static/css/sprites.css" rel="stylesheet">
+</%block>
+
<%block name="navigation">
${nav.nav('games')}
</%block>
</%block>
% if not games:
+ % if not game_type_cd:
<h2>Sorry, no games yet. Get playing!</h2>
+ % else:
+<h2>Sorry, no ${game_type_cd.upper()} games yet. Get playing!</h2>
+ % endif
<p><a href="${player_url}">Back to player info page</a></p>
% else:
<p><a href="${player_url}">Back to player info page</a></p>
</div>
</div>
+<br/>
<div class="row">
- <div class="span12">
+ <div class="span12 tabbable">
+ <ul class="nav nav-tabs">
+ % for game in games_played:
+ <li>
+ % if game.game_type_cd == 'overall':
+ <a href="${request.route_url("player_game_index", player_id=player.player_id)}" alt="${game.game_type_cd}" title="" data-toggle="none">
+ % else:
+ <a href="${request.route_url("player_game_index_filtered", player_id=player.player_id, game_type_cd=game.game_type_cd)}" alt="${game.game_type_cd}" title="" data-toggle="none">
+ % endif
+ <span class="sprite sprite-${game.game_type_cd}"> </span><br />
+ ${game.game_type_cd} <br />
+ </a>
+ </li>
+ % endfor
+ </ul>
+ </div>
+ <div class="span12 tab-content" style="margin-top:10px;">
<table class="table table-hover table-condensed">
<thead>
<tr>
</div>
</div>
+
<!-- navigation links -->
${navlinks("player_game_index", games.page, games.last_page, player_id=player_id)}
% endif
<ul id="gbtab" class="nav nav-tabs">
% for g in games_played:
<li>
- <a href="#tab-${g.game_type_cd}" data-toggle="tab">
+ <a href="#tab-${g.game_type_cd}" data-toggle="tab" alt="${g.game_type_cd}" title="">
<span class="sprite sprite-${g.game_type_cd}"> </span><br />
${g.game_type_cd} <br />
<small>(${g.games})</small>
current_page = request.params['page']
else:
current_page = 1
-
- rgs_q = recent_games_q(game_type_cd=game_type_cd)
+
+ try:
+ rgs_q = recent_games_q(game_type_cd=game_type_cd)
- games = Page(rgs_q, current_page, items_per_page=10, url=page_url)
+ games = Page(rgs_q, current_page, items_per_page=10, url=page_url)
- # replace the items in the canned pagination class with more rich ones
- games.items = [RecentGame(row) for row in games.items]
-
- pgstats = {}
- for game in games.items:
- pgstats[game.game_id] = DBSession.query(PlayerGameStat).\
- filter(PlayerGameStat.game_id == game.game_id).\
- order_by(PlayerGameStat.scoreboardpos).\
- order_by(PlayerGameStat.score).all()
+ # replace the items in the canned pagination class with more rich ones
+ games.items = [RecentGame(row) for row in games.items]
+
+ pgstats = {}
+ for game in games.items:
+ pgstats[game.game_id] = DBSession.query(PlayerGameStat).\
+ filter(PlayerGameStat.game_id == game.game_id).\
+ order_by(PlayerGameStat.scoreboardpos).\
+ order_by(PlayerGameStat.score).all()
+
+ except Exception as e:
+ games = None
+ pgstats = None
+ game_type_cd = None
return {'games':games,
'pgstats':pgstats,
- 'game_type_cd':game_type_cd}
+ 'game_type_cd':game_type_cd,
+ }
def game_index(request):
# replace the items in the canned pagination class with more rich ones
games.items = [RecentGame(row) for row in games.items]
+
+ games_played = get_games_played(player_id)
except Exception as e:
player = None
games = None
+ game_type_cd = None
+ games_played = None
return {
'player_id':player.player_id,
'player':player,
'games':games,
'game_type_cd':game_type_cd,
+ 'games_played':games_played,
}