]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/search.mako
Clean up the submit_stats function and its dependents.
[xonotic/xonstat.git] / xonstat / templates / search.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('games')}
7 </%block>
8
9 % if results == None:
10
11   <%block name="title">
12     Advanced Search
13   </%block>
14
15   <div class="row">
16     <div class="small-12 large-6 large-offset-3 columns">
17
18       <form class="form-horizontal">
19         <fieldset>
20
21           <!-- Form submitted? -->
22           <input type="hidden" name="fs" />
23
24           <!-- Text input-->
25           <div class="control-group">
26             <label class="control-label">Nick</label>
27             <div class="controls">
28               <input id="nick" name="nick" type="text" placeholder="player nick" class="input-xlarge">
29               <p class="help-block"></p>
30             </div>
31           </div>
32
33           <!-- Text input-->
34           <div class="control-group">
35             <label class="control-label">Server</label>
36             <div class="controls">
37               <input id="server_name" name="server_name" type="text" placeholder="server name" class="input-xlarge">
38               <p class="help-block"></p>
39             </div>
40           </div>
41
42           <!-- Text input-->
43           <div class="control-group">
44             <label class="control-label">Map</label>
45             <div class="controls">
46               <input id="map_name" name="map_name" type="text" placeholder="map name" class="input-xlarge">
47               <p class="help-block"></p>
48             </div>
49           </div>
50
51           <!-- Multiple Checkboxes -->
52           <div class="control-group">
53             <label class="control-label">Game Types</label>
54             <div class="controls">
55               <label class="checkbox">
56                 <input type="checkbox" name="dm" value="Deathmatch">
57                 Deathmatch
58               </label>
59               <label class="checkbox">
60                 <input type="checkbox" name="duel" value="Duel">
61                 Duel
62               </label>
63               <label class="checkbox">
64                 <input type="checkbox" name="ctf" value="Capture The Flag">
65                 Capture The Flag
66               </label>
67               <label class="checkbox">
68                 <input type="checkbox" name="tdm" value="Team Deathmatch">
69                 Team Deathmatch
70               </label>
71             </div>
72           </div>
73
74           <!-- Button -->
75           <div class="control-group">
76             <label class="control-label"></label>
77             <div class="controls">
78               <button id="submit" name="submit" type="submit" class="btn btn-primary">Submit</button>
79             </div>
80           </div>
81
82         </fieldset>
83       </form>
84
85     </div>
86   </div>
87
88
89 % elif len(results) == 0:
90   <div class="row">
91     <div class="small-12 large-6 large-offset-3 columns">
92       <h1 class="text-center">Sorry, nothing found!</h1>
93     </div>
94   </div>
95
96 % else:
97
98   ##### player-only results #####
99   % if result_type == "player":
100     <div class="row">
101       <div class="small-12 large-8 large-offset-2 columns">
102         <table class="table-hover table-condensed">
103           <tr>
104             <th class="small-2">ID</th>
105             <th class="small-6">Nick</th>
106             <th class="small-3">Joined</th>
107             <th class="small-1"></th>
108           </tr>
109           % for player in results:
110             <tr>
111               <td>${player.player_id}</th>
112               <td class="no-stretch"><a href="${request.route_url("player_info", id=player.player_id)}" title="Go to this player's info page">${player.nick_html_colors()|n}</a></th>
113               <td><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${player.fuzzy_date()}</span></th>
114               <td class="text-center">
115                 <a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="View recent games by this player">
116                   <i class="fa fa-list"></i>
117                 </a>
118               </td>
119             </tr>
120           % endfor
121         </table>
122   % endif
123
124   ##### server-only results #####
125   % if result_type == "server":
126     <div class="row">
127       <div class="small-12 large-8 large-offset-2 columns">
128         <table class="table-hover table-condensed">
129           <tr>
130             <th class="small-2">ID</th>
131             <th class="small-6">Name</th>
132             <th class="small-3">Added</th>
133             <th class="small-1"></th>
134           </tr>
135           % for server in results:
136             <tr>
137               <td>${server.server_id}</td>
138               <td><a href="${request.route_url("server_info", id=server.server_id)}" title="Go to this server's info page">${server.name}</a></th>
139               <td><span class="abstime" data-epoch="${server.epoch()}" title="${server.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${server.fuzzy_date()}</span></td>
140               <td class="text-center">
141                 <a href="${request.route_url("game_index", _query={'server_id':server.server_id})}" title="View recent games on this server">
142                   <i class="fa fa-list"></i>
143                 </a>
144               </td>
145             </tr>
146           % endfor
147         </table>
148   % endif
149
150   ##### map-only results #####
151   % if result_type == "map":
152     <div class="row">
153       <div class="small-12 large-8 large-offset-2 columns">
154         <table class="table-hover table-condensed">
155           <tr>
156             <th class="small-2">ID</th>
157             <th class="small-6">Name</th>
158             <th class="small-3">Added</th>
159             <th class="small-1"></th>
160           </tr>
161           % for map in results:
162             <tr>
163               <td>${map.map_id}</td>
164               <td><a href="${request.route_url("map_info", id=map.map_id)}" title="Go to this map's info page">${map.name}</a></th>
165               <td><span class="abstime" data-epoch="${map.epoch()}" title="${map.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${map.fuzzy_date()}</span></td>
166                <td class="text-center">
167                 <a href="${request.route_url("game_index", _query={'map_id':map.map_id})}" title="View recent games on this map">
168                   <i class="fa fa-list"></i>
169                 </a>
170               </td>
171             </tr>
172           % endfor
173         </table>
174   % endif
175
176   ##### game results #####
177   % if result_type == "game":
178   <div class="row">
179     <div class="small-12 large-8 large-offset-2 columns">
180       <table class="table-hover table-condensed">
181         <tr>
182           <th class="small-3"></th>
183           <th class="small-3 medium-6">Map</th>
184           <th class="small-3 medium-3">Server</th>
185           <th class="small-3">Time</th>
186         </tr>
187         % for (game, server, gmap) in results:
188           <tr>
189             <td class="text-center"><a class="tiny button" href="${request.route_url("game_info", id=game.game_id)}" name="Game info page for game #${game.game_id}">View</a></td>
190             <td class="no-stretch"><a href="${request.route_url("map_info", id=gmap.map_id)}" name="Map info page for map #${gmap.map_id}">${gmap.name}</a></td>
191             <td><a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for server #${server.server_id}">${server.name}</a></td>
192             <td><span class="abstime" data-epoch="${game.epoch()}" title="${game.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${game.fuzzy_date()}</span></td>
193           </tr>
194         % endfor
195       </table>
196   % endif
197
198       <!-- navigation links -->
199       ${navlinks("search", results.page, results.last_page, search_query=query)}
200     </div>
201   </div>
202 % endif