Highlight the filtered game mode.
[xonotic/xonstat.git] / xonstat / templates / player_game_index.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3 <%namespace file="navlinks.mako" import="navlinks" />
4
5 <%block name="css">
6 ${parent.css()}
7 <link href="/static/css/sprites.css" rel="stylesheet">
8 </%block>
9
10 <%block name="navigation">
11 ${nav.nav('games')}
12 </%block>
13
14 <%block name="title">
15 Recent Games
16 </%block>
17
18 % if not games:
19 <h2>Sorry, no 
20     % if game_type_descr:
21     ${game_type_descr.lower()}
22     % endif
23   games yet for 
24   <a href="${request.route_url('player_info', id=player.player_id)}">${player.nick_html_colors()|n}</a>. Get playing!
25 </h2>
26 <p><a href="${player_url}">Back to player info page</a></p>
27
28 % else:
29 <div class="row">
30   <div class="span12">
31     <h3>Recent 
32       % if game_type_descr:
33       ${game_type_descr}
34       % endif
35       Games by 
36       <a href="${request.route_url('player_info', id=player.player_id)}">
37         ${player.nick_html_colors()|n}
38       </a>
39     </h3>
40   </div>
41 </div>
42
43 <div class="row">
44   <div class="span12 tabbable">
45     <ul class="nav nav-tabs">
46       % for game in games_played:
47       <li 
48       % if game.game_type_cd == game_type_cd or (game.game_type_cd == 'overall' and game_type_cd is None):
49       class="active"
50       % endif
51       >
52
53       % if game.game_type_cd == 'overall':
54       <a href="${request.route_url("player_game_index", player_id=player.player_id)}" alt="${game.game_type_cd}" title="" data-toggle="none">
55       % else:
56       <a href="${request.route_url("player_game_index", player_id=player.player_id, _query={'type':game.game_type_cd})}" alt="${game.game_type_cd}" title="" data-toggle="none">
57       % endif
58         <span class="sprite sprite-${game.game_type_cd}"> </span><br />
59         ${game.game_type_cd} <br />
60       </a>
61       </li>
62       % endfor
63     </ul>
64   </div>
65   <div class="span12 tab-content" style="margin-top:10px;">
66     <table class="table table-hover table-condensed">
67       <thead>
68         <tr>
69           <th></th>
70           <th>Type</th>
71           <th>Server</th>
72           <th>Map</th>
73           <th>Result</th>
74           <th>Played</th>
75           <th>Elo</th>
76         </tr>
77       </thead>
78       <tbody>
79       % for rg in games.items:
80       <tr>
81         <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>
82         <td class="tdcenter"><img title="${rg.game_type_cd}" src="/static/images/icons/24x24/${rg.game_type_cd}.png" alt="${rg.game_type_cd}" /></td>
83         <td><a href="${request.route_url("server_info", id=rg.server_id)}" name="Server info page for ${rg.server_name}">${rg.server_name}</a></td>
84         <td><a href="${request.route_url("map_info", id=rg.map_id)}" name="Map info page for ${rg.map_name}">${rg.map_name}</a></td>
85         <td>
86           % if rg.team != None:
87           % if rg.team == rg.winner:
88           Win
89           % else:
90           Loss
91           % endif
92           % else:
93           % if rg.rank == 1:
94           Win
95           % else:
96           Loss (#${rg.rank})
97           % endif
98           % endif
99         </td>
100         <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>
101         <td class="tdcenter">
102           <a href="${request.route_url('game_info', id=rg.game_id, _query={'show_elo':1})}" title="View detailed information about this game">
103             % if rg.elo_delta is not None:
104             % if round(rg.elo_delta,2) > 0:
105             <span class="eloup" title="Elo went up by ${round(rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-up"></i></span>
106             % elif round(rg.elo_delta,2) < 0:
107             <span class="elodown" title="Elo went down by ${round(-rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-down"></i></span>
108             % else:
109             <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
110             % endif
111             % else:
112             <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
113             % endif
114           </a>
115         </td>
116       </tr>
117       % endfor
118       </tbody>
119     </table>
120   </div>
121 </div>
122
123
124 <!-- navigation links -->
125 ${navlinks("player_game_index", games.page, games.last_page, player_id=player_id, search_query=request.GET)}
126 % endif