add typeahead for tournament names
[mlpccg-meta.git] / meta / templates / rate.html
index c9627a5..939b202 100644 (file)
@@ -1,7 +1,56 @@
 {% extends "base.html" %}
+{% load humanize %}
 
 {% block content %}
 
-{{ label }}
+<div class="row">
+  <div class="col-xs-12">
+    <h2><a href="{{ deck.ponyhead_link }}">{{ deck.description }}</a></h2>
+    <p>Decks similiar to yours and their placement in past tournaments:</p>
+    <table class="table">
+      <tr>
+        <th>Deck</th>
+        <th>Placement</th>
+        <th>Tournament</th>
+        <th>Date</th>
+        <th>Notes</th>
+      </tr>
+    {% for deck, record in similiar reversed %}
+      <tr class="{% if not record.verified %}warning{% endif %}">
+        <td><a href="{{ deck.ponyhead_link }}">{{ deck.name }}</a></td>
+        <td>{{ record.placement|ordinal }}</td>
+        <td><a href="/meta/tournaments/{{ record.tournament.id }}">{{ record.tournament.name }}</a></td>
+        <td>{{ record.tournament.date }}</td>
+        <td>{% if not record.verified %}user-submitted{% endif %}</td>
+      </tr>
+    {% endfor %}
+      <tr>
+        <td colspan="5"><strong>Played this deck in a tournament? Add your result here!</strong></td>
+      </tr>
+      <form class="form-inline" action="/meta/rate" method="post" role="form">
+        {% csrf_token %}
+        <input type="hidden" name="url" value="{{ deck.ponyhead_link }}"/>
+        <tr class="info">
+          <td><input type="text" name="deck_name" class="form-control" placeholder="Deck name"/></td>
+          <td>
+            <select name="placement" class="form-control">
+              <option value="1">1st</option>
+              <option value="2">2nd</option>
+              <option value="3">3rd</option>
+              <option value="4">4th</option>
+              <option value="5">5th</option>
+              <option value="6">6th</option>
+              <option value="7">7th</option>
+              <option value="8">8th</option>
+            </select>
+          </td>
+          <td><input type="text" name="name" class="form-control typeahead-tournaments" placeholder="Tournament name"/></td>
+          <td><input type="date" name="date" class="form-control"/></td>
+          <td><button type="submit" class="btn btn-primary">Submit</button></td>
+        </tr>
+      </form>
+    </table>
+  </div>
+</div>
 
 {% endblock %}