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