Merge branch 'master' into zykure/approved
[xonotic/xonstat.git] / xonstat / templates / map_info.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3 <%namespace file="navlinks.mako" import="navlinks" />
4
5 <%block name="navigation">
6 ${nav.nav('maps')}
7 </%block>
8
9 <%block name="title">
10 % if gmap:
11 Map Information
12 % endif
13
14 ${parent.title()}
15 </%block>
16
17 <%block name="css">
18     ${parent.css()}
19     <link href="/static/css/sprites.css" rel="stylesheet">
20 </%block>
21
22 % if gmap is None:
23 <h2>Sorry, that map wasn't found!</h2>
24
25 % else:
26 <h2>${gmap.name}</h2>
27 <p>
28   Added <span class="abstime" data-epoch="${gmap.epoch()}" title="${gmap.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${gmap.fuzzy_date()}</span>
29 </p>
30 <div class="row">
31   <div class="span4">
32     <h3>Top Scoring Players</h3>
33     <table class="table table-hover table-condensed">
34       <thead>
35         <tr>
36           <th style="width:40px;">#</th>
37           <th style="width:150px;">Nick</th>
38           <th style="width:90px;">Score</th>
39         </tr>
40       </thead>
41       <tbody>
42         <% i = 1 %>
43         % for (score_player_id, score_nick, score_value) in top_scorers:
44         <tr>
45           <td>${i}</td>
46           % if score_player_id != '-':
47           <td class="nostretch" style="max-width:150px;"><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>
48           % else:
49           <td class="nostretch" style="max-width:150px;">${score_nick}</td>
50           % endif
51           <td>${score_value}</td>
52         </tr>
53         <% i = i+1 %>
54         % endfor
55         </tbody>
56     </table>
57   </div>
58
59
60 <div class="span4">
61   <h3>Most Active Players</h3>
62   <table class="table table-hover table-condensed">
63     <thead>
64       <tr>
65         <th style="width:40px;">#</th>
66         <th style="width:150px;">Nick</th>
67         <th style="width:90px;">Playing Time</th>
68       </tr>
69     </thead>
70     <tbody>
71     <% i = 1 %>
72     % for (player_id, nick, alivetime) in top_players:
73       <tr>
74         <td>${i}</td>
75         % if player_id != '-':
76         <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>
77         % else:
78         <td class="nostretch" style="max-width:150px;">${nick}</td>
79         % endif
80         <td>${alivetime}</td>
81       </tr>
82       <% i = i+1 %>
83     % endfor
84     </tbody>
85   </table>
86 </div>
87
88
89 <div class="span4">
90   <h3>Most Active Servers</h3>
91   <table class="table table-hover table-condensed">
92     <thead>
93       <tr>
94         <th style="width:40px;">#</th>
95         <th style="width:150px;">Name</th>
96         <th style="width:90px;"># Games</th>
97       </tr>
98     </thead>
99     <tbody>
100     <% i = 1 %>
101     % for (server_id, name, times_played) in top_servers:
102       <tr>
103         <td>${i}</td>
104         <td class="nostretch" style="max-width:150px;"><a href="${request.route_url('server_info', id=server_id)}" title="Go to the server info page for this server">${name}</a></td>
105         <td>${times_played}</td>
106       </tr>
107       <% i = i+1 %>
108     % endfor
109     </tbody>
110 </table>
111 </div>
112 </div> <!-- /row -->
113
114 <div class="row">
115   <div class="span12">
116     <p class="note">*Most active stats are from the past 7 days</p>
117   </div>
118 </div>
119
120 % if len(captimes) > 0:
121 <div class="row">
122   <div class="span6">
123     <h3>Best Flag Capture Times</h3>
124     <table class="table table-hover table-condensed">
125       <thead>
126         <tr>
127            <th>Nick</th>
128            <th>Captime</th>
129         </tr>
130       </thead>
131       <tbody>
132       % for c in captimes:
133         <tr>
134           <td>
135           % if c.player_id > 2:
136             <a href="${request.route_url("player_info", id=c.player_id)}"
137              title="Go to the info page for this player">
138             <span class="nick">${c.nick_html_colors|n}</span>
139             </a>
140           % else:
141             <span class="nick">${c.nick_html_colors|n}</span>
142           % endif
143           </td>
144           <td>
145             <a href="${request.route_url("game_info", id=c.game_id)}"
146              title="View the game in which this cap was made">
147               ${round(float(c.fastest_cap.seconds) + (c.fastest_cap.microseconds/1000000.0), 2)}
148             </a>
149           </td>
150         </tr>
151       % endfor
152       </tbody>
153     </table>
154   </div>
155 </div>
156 % endif
157
158
159 % if len(recent_games) > 0:
160 <div class="row">
161   <div class="span12">
162     <h3>Most Recent Games</h3>
163     <table class="table table-hover table-condensed">
164       <thead>
165         <tr>
166           <th></th>
167           <th>Type</th>
168           <th>Server</th>
169           <th>Time</th>
170           <th>Winner</th>
171         </tr>
172       </thead>
173       <tbody>
174         % for rg in recent_games:
175         <tr>
176           <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>
177           <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
178           <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>
179           <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>
180           <td class="nostretch">
181             % if rg.player_id > 2:
182             <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>
183             % else:
184             ${rg.nick_html_colors|n}
185             % endif
186           </td>
187         </tr>
188         % endfor
189       </tbody>
190     </table>
191     <p><a href="${request.route_url('game_index', _query={'map_id':gmap.map_id})}">More...</a></p>
192   </div>
193 </div>
194 % endif
195
196
197 % endif