]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/server_info.mako
Fix the recent games table for the server info page.
[xonotic/xonstat.git] / xonstat / templates / server_info.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3
4 <%block name="navigation">
5   ${nav.nav('servers')}
6 </%block>
7
8 <%block name="title">
9   % if server:
10     Server Information
11   % endif
12 </%block>
13
14 <%block name="css">
15   ${parent.css()}
16   <link href="/static/css/sprites.css" rel="stylesheet">
17 </%block>
18
19 % if server is None:
20   <h2>Sorry, that server wasn't found!</h2>
21
22 % else:
23   <div class="row">
24     <div class="small-12 columns">
25       <h2>${server.name}</h2>
26       <p>
27         IP Address: 
28         % if server.port is not None:
29         ${server.ip_addr}:${server.port}
30         % else:
31         ${server.ip_addr}
32         % endif
33         <br />
34         Revision: ${server.revision} <br />
35         Added <span class="abstime" data-epoch="${server.epoch()}" title="${server.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${server.fuzzy_date()}</span> <br />
36       </p>
37     </div>
38   </div>
39
40
41   <div class="row">
42     <div class="small-12 large-4 columns">
43       <h5>Top Scoring Players</h5>
44       <table class="table-hover table-condensed">
45         <thead>
46           <tr>
47             <th style="small-2">#</th>
48             <th style="small-7">Nick</th>
49             <th style="small-3">Score</th>
50           </tr>
51         </thead>
52         <tbody>
53         <% i = 1 %>
54         % for (score_player_id, score_nick, score_value) in top_scorers:
55           <tr>
56             <td>${i}</td>
57             % if score_player_id != '-':
58               <td class="no-stretch"><a href="${request.route_url('player_info', id=score_player_id)}" title="Go to the player info page for this player">${score_nick|n}</a></td>
59             % else:
60               <td class="no-stretch">${score_nick}</td>
61             % endif
62             <td>${score_value}</td>
63           </tr>
64           <% i = i+1 %>
65         % endfor
66         </tbody>
67       </table>
68     </div>
69
70     <div class="small-12 large-4 columns">
71       <h5>Most Active Players</h5>
72       <table class="table-hover table-condensed">
73         <thead>
74           <tr>
75             <th style="small-2">#</th>
76             <th style="small-7">Nick</th>
77             <th style="small-3">Play Time</th>
78           </tr>
79         </thead>
80         <tbody>
81         <% i = 1 %>
82         % for (player_id, nick, alivetime) in top_players:
83           <tr>
84             <td>${i}</td>
85             % if player_id != '-':
86               <td class="no-stretch"><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick|n}</a></td>
87             % else:
88               <td class="no-stretch">${nick}</td>
89             % endif
90             <td>${alivetime}</td>
91           </tr>
92           <% i = i+1 %>
93         % endfor
94         </tbody>
95       </table>
96     </div>
97
98     <div class="small-12 large-4 columns">
99       <h5>Most Active Maps</h5>
100       <table class="table-hover table-condensed">
101         <thead>
102           <tr>
103             <th style="small-2">#</th>
104             <th style="small-7">Map</th>
105             <th style="small-3"># Games</th>
106           </tr>
107         </thead>
108         <tbody>
109         <% i = 1 %>
110         % for (map_id, name, count) in top_maps:
111           <tr>
112             <td>${i}</td>
113             % if map_id != '-':
114               <td class="no-stretch"><a href="${request.route_url('map_info', id=map_id)}" title="Go to the map info page for ${name}">${name}</a></td>
115             % else:
116               <td class="no-stretch">${name}</td>
117             % endif
118             <td>${count}</td>
119           </tr>
120           <% i = i+1 %>
121         % endfor
122         </tbody>
123       </table>
124     </div> 
125   </div>
126
127   <div class="row">
128     <div class="small-12 columns">
129       <small>*Most active stats are from the past 7 days</small>
130     </div>
131   </div>
132
133
134   % if len(recent_games) > 0:
135     <div class="row">
136       <div class="small-12 columns">
137         <h5>Most Recent Games</h5>
138         <table class="table-hover table-condensed">
139           <thead>
140             <tr>
141               <th class="small-1 text-center"></th>
142               <th class="small-1">Type</th>
143               <th class="show-for-medium-up small-3">Map</th>
144               <th class="show-for-large-up small-3">Time</th>
145               <th class="small-3">Winner</th>
146             </tr>
147           </thead>
148           <tbody>
149             % for rg in recent_games:
150             <tr>
151               <td class="text-center"><a class="tiny button" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">View</a></td>
152               <td class="text-center"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
153               <td class="show-for-medium-up"><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the map detail page for this map">${rg.map_name}</a></td>
154               <td class="show-for-large-up"><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>
155               <td class="no-stretch">
156                 % if rg.player_id > 2:
157                 <a href="${request.route_url('player_info', id=rg.player_id)}" title="Go to the player info page for this player">${rg.nick_html_colors|n}</a>
158                 % else:
159                 ${rg.nick_html_colors|n}
160                 % endif
161               </td>
162             </tr>
163             % endfor
164           </tbody>
165         </table>
166         <p><a href="${request.route_url('game_index', _query={'server_id':server.server_id})}">More...</a></p>
167       </div>
168     </div>
169   % endif
170 % endif