Add links to view more active stats.
[xonotic/xonstat.git] / xonstat / templates / main_index.mako
1 <%inherit file="base.mako"/>
2
3 <%block name="title">
4 Leaderboard
5 </%block>
6
7 <%block name="css">
8   ${parent.css()}
9   <link href="/static/css/sprites.css" rel="stylesheet">
10 </%block>
11
12 <%block name="hero_unit">
13   <div class="text-center">
14     <img src="/static/css/img/web_background_l2.png" />
15     % if summary_stats is None:
16     <p id="statline">Tracking Xonotic statistics since October 2011.</p>
17     % else:
18     <p id="statline">Tracking <a href="${request.route_url('player_index')}">${'{:2,d}'.format(summary_stats.total_players)}</a> players, <a href="${request.route_url('game_index')}">${'{:2,d}'.format(summary_stats.total_games)}</a> games (${'{:2,d}'.format(summary_stats.duel_games)} duel; ${'{:2,d}'.format(summary_stats.ctf_games)} ctf; ${'{:2,d}'.format(summary_stats.dm_games)} dm) and <a href="${request.route_url('server_index')}">${'{:2,d}'.format(summary_stats.total_servers)}</a> servers since October 2011.</p>
19     % endif
20   </div>
21 </%block>
22
23 ##### RANKS #####
24 % if len(ranks) < 4:
25   <div class="row">
26     <div class="span12">
27       <p style="text-align: center;"><i class="icon-white icon-info-sign"> </i> You don't seem to have any ranks yet.</p>
28     </div> <!-- span12 -->
29   </div> <!-- row -->
30
31 % else:
32   <div class="row">
33     % for rs in ranks[:4]:
34     % if len(rs) > 0:
35     <div class="span3">
36       % if rs[0].game_type_cd == 'duel':
37       <h3>Duel Ranks</h3>
38       % elif rs[0].game_type_cd == 'ctf':
39       <h3>CTF Ranks</h3>
40       % elif rs[0].game_type_cd == 'dm':
41       <h3>DM Ranks</h3>
42       % elif rs[0].game_type_cd == 'tdm':
43       <h3>TDM Ranks</h3>
44       % endif
45
46       <table class="table table-hover table-condensed">
47         <thead>
48           <tr>
49             <th style="width:40px;">#</th>
50             <th style="width:150px;">Nick</th>
51             <th style="width:60px;">Elo</th>
52           </tr>
53         </thead>
54         <tbody>
55         <% i = 1 %>
56         % for r in rs:
57         <tr>
58           <td>${i}</td>
59           <td class="nostretch" style="max-width:150px;"><a href="${request.route_url('player_info', id=r.player_id)}" title="Go to the player info page for this player">${r.nick_html_colors()|n}</a></td>
60           <td>${int(round(r.elo))}</td>
61         </tr>
62         <% i = i+1 %>
63         % endfor
64         </tbody>
65       </table>
66       <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd=rs[0].game_type_cd)}" title="See more ${rs[0].game_type_cd} rankings">More...</a></p>
67     </div> <!-- /span4 -->
68   % endif
69
70   % endfor
71 </div> <!-- row -->
72 % endif
73
74
75 ##### ACTIVE PLAYERS #####
76 <div class="row">
77   <div class="span4">
78     <h3>Most Active Players</h3>
79     <table class="table table-hover table-condensed">
80       <thead>
81         <tr>
82           <th style="width:40px;">#</th>
83           <th style="width:150px;">Nick</th>
84           <th class="play-time" style="width:90px;">Play Time</th>
85         </tr>
86       </thead>
87       <tbody>
88       <% i = 1 %>
89       % for (player_id, nick, alivetime) in top_players:
90         <tr>
91           <td>${i}</td>
92           % if player_id != '-':
93           <td class="nostretch" style="max-width:150px;"><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick|n}</a></td>
94           % else:
95           <td class="nostretch" style="max-width:150px;">${nick|n}</td>
96           % endif
97           <td class="play-time">${alivetime}</td>
98         </tr>
99         <% i = i+1 %>
100       % endfor
101       </tbody>
102     </table>
103     <p class="note"><a href="${request.route_url('top_players_by_time', page=1)}" title="See more player activity">More...</a></p>
104   </div> <!-- /span4 -->
105
106
107 ##### ACTIVE SERVERS #####
108   <div class="span4">
109     <h3>Most Active Servers</h3>
110     <table class="table table-hover table-condensed">
111       <thead>
112         <tr>
113           <th style="width:40px;">#</th>
114           <th style="width:180px;">Server</th>
115           <th style="width:60px;">Games</th>
116         </tr>
117       </thead>
118       <tbody>
119       <% i = 1 %>
120       % for (server_id, name, count) in top_servers:
121         <tr>
122           <td>${i}</td>
123           % if server_id != '-':
124           <td class="nostretch" style="max-width:180px;"><a href="${request.route_url('server_info', id=server_id)}" title="Go to the server info page for ${name}">${name}</a></td>
125           % else:
126           <td class="nostretch" style="max-width:180px;">${name}</td>
127           % endif
128           <td>${count}</td>
129         </tr>
130         <% i = i+1 %>
131       % endfor
132       </tbody>
133     </table>
134     <p class="note"><a href="${request.route_url('top_servers_by_players', page=1)}" title="See more server activity">More...</a></p>
135   </div> <!-- /span4 -->
136
137
138 ##### ACTIVE MAPS #####
139   <div class="span4">
140     <h3>Most Active Maps</h3>
141     <table class="table table-hover table-condensed">
142       <thead>
143         <tr>
144           <th style="width:40px;">#</th>
145           <th style="width:180px;">Map</th>
146           <th style="width:60px;">Games</th>
147         </tr>
148       </thead>
149       <tbody>
150       <% i = 1 %>
151       % for (map_id, name, count) in top_maps:
152         <tr>
153           <td>${i}</td>
154           % if map_id != '-':
155           <td class="nostretch" style="max-width:180px;"><a href="${request.route_url('map_info', id=map_id)}" title="Go to the map info page for ${name}">${name}</a></td>
156           % else:
157           <td class="nostretch" style="max-width:180px;">${name}</td>
158           % endif
159           <td>${count}</td>
160         </tr>
161         <% i = i+1 %>
162       % endfor
163       </tbody>
164     </table>
165     <p class="note"><a href="${request.route_url('top_maps_by_times_played', page=1)}" title="See more map activity">More...</a></p>
166   </div> <!-- /span4 -->
167 </div> <!-- /row -->
168 <row class="span12">
169     <p class="note">*Most active stats are from the past 7 days</p>
170 </div>
171
172
173 ##### RECENT GAMES #####
174 % if len(recent_games) > 0:
175 <div class="row">
176   <div class="span12">
177     <h3>Recent Games</h3>
178     <table class="table table-hover table-condensed">
179       <thead>
180         <tr>
181           <th></th>
182           <th>Type</th>
183           <th>Server</th>
184           <th>Map</th>
185           <th>Time</th>
186           <th>Winner</th>
187         </tr>
188       </thead>
189       <tbody>
190       % for rg in recent_games:
191         <tr>
192           <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>
193           <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
194           <td><a href="${request.route_url('server_info', id=rg.server_id)}" title="Go to the detail page for this server">${rg.server_name}</a></td>
195           <td><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>
196           <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>
197           <td class="nostretch">
198             % if rg.player_id > 2:
199             <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></td>
200             % else:
201             ${rg.nick_html_colors|n}</td>
202             % endif
203         </tr>
204         % endfor
205         </tbody>
206     </table>
207     <p><a href="${request.route_url('game_index')}">More...</a></p>
208   </div> <!-- /span12 -->
209 </div> <!-- /row -->
210 % endif