Merge branch 'master' into zykure/approved
[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       % if not game.game_type_cd in ['cq']:
48       <li 
49       % if game.game_type_cd == game_type_cd or (game.game_type_cd == 'overall' and game_type_cd is None):
50       class="active"
51       % endif
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       % endif
63       % endfor
64     </ul>
65   </div>
66   <div class="span12 tab-content" style="margin-top:10px;">
67     <table class="table table-hover table-condensed">
68       <thead>
69         <tr>
70           <th></th>
71           <th>Type</th>
72           <th>Server</th>
73           <th>Map</th>
74           <th>Result</th>
75           <th>Played</th>
76           <th>Elo</th>
77         </tr>
78       </thead>
79       <tbody>
80       % for rg in games.items:
81       <tr>
82         <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>
83         <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>
84         <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>
85         <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>
86         <td>
87           % if rg.team != None:
88           % if rg.team == rg.winner:
89           Win
90           % else:
91           Loss
92           % endif
93           % else:
94           % if rg.rank == 1:
95           Win
96           % else:
97           Loss (#${rg.rank})
98           % endif
99           % endif
100         </td>
101         <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>
102         <td class="tdcenter">
103           <a href="${request.route_url('game_info', id=rg.game_id, _query={'show_elo':1})}" title="View detailed information about this game">
104             % if rg.elo_delta is not None:
105             % if round(rg.elo_delta,2) > 0:
106             <span class="eloup" title="Elo went up by ${round(rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-up"></i></span>
107             % elif round(rg.elo_delta,2) < 0:
108             <span class="elodown" title="Elo went down by ${round(-rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-down"></i></span>
109             % else:
110             <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
111             % endif
112             % else:
113             <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
114             % endif
115           </a>
116         </td>
117       </tr>
118       % endfor
119       </tbody>
120     </table>
121   </div>
122 </div>
123
124
125 <!-- navigation links -->
126 ${navlinks("player_game_index", games.page, games.last_page, player_id=player_id, search_query=request.GET)}
127 % endif