]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Add a simple form for the versus view.
authorAnt Zucaro <azucaro@gmail.com>
Sat, 12 Mar 2016 14:22:26 +0000 (09:22 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 12 Mar 2016 14:22:26 +0000 (09:22 -0500)
xonstat/templates/player_versus.mako
xonstat/views/player.py

index 8f81a45abc8e3cfbb6394580f1d2fc7ca846a53b..01600a4745e1dbc33923bda571e4b999c707a22f 100644 (file)
@@ -6,6 +6,7 @@
   ${nav.nav('players')}
 </%block>
 
+% if p1 is not None and p2 is not None:
 <div class="row">
   <div class="small-5 columns text-right">
     <h3>${p1.nick_html_colors()|n}</h3>
   </div>
 </div>
 % endif
+
+% else:
+
+<div class="row">
+  <div class="small-12 large-8 large-offset-2 columns">
+
+    <form class="form-horizontal">
+      <fieldset>
+
+        <div class="row">
+          <div class="small-5 columns">
+            <div class="control-group">
+              <label class="control-label">Player #1</label>
+              <div class="controls">
+                <input id="p1" name="p1" type="text" class="input-xlarge">
+              </div>
+            </div>
+          </div>
+
+          <div class="small-2 columns text-center">
+            <h3>vs</h3>
+          </div>
+
+          <div class="small-5 columns">
+            <div class="control-group">
+              <label class="control-label">Player #2</label>
+              <div class="controls">
+                <input id="p2" name="p2" type="text" class="input-xlarge">
+              </div>
+            </div>
+          </div>
+
+        </div>
+
+        <!-- Button -->
+        <div class="control-group">
+          <label class="control-label"></label>
+          <div class="controls">
+            <button id="submit" name="submit" type="submit" class="btn btn-primary">Compare!</button>
+          </div>
+        </div>
+
+      </fieldset>
+    </form>
+
+  </div>
+</div>
+
+% endif
index 7668774501756d054330a8920fce623aa6d168fc..83238adb5c59d194bab3f277052fe85b1fd7b406 100644 (file)
@@ -1167,9 +1167,18 @@ def player_versus_data(request):
 
     except Exception as e:
         log.debug(e)
-        raise pyramid.httpexceptions.HTTPNotFound
+
+        p1_id = None
+        p2_id = None
+        p1 = None
+        p2 = None
+        p1_wins = None
+        p2_wins = None
+        rgs = None
 
     return {
+            "p1_id" : p1_id,
+            "p2_id" : p2_id,
             "p1" : p1,
             "p2" : p2,
             "p1_wins" : p1_wins,