Code layout change.
[wolnelektury.git] / src / polls / templates / polls / tags / poll.html
diff --git a/src/polls/templates/polls/tags/poll.html b/src/polls/templates/polls/tags/poll.html
new file mode 100644 (file)
index 0000000..4c4d2b5
--- /dev/null
@@ -0,0 +1,28 @@
+{% load i18n %}
+{% load ssi_csrf_token from ssify %}
+
+{% if poll %}
+    {% if voted_already %}
+        {% if show_results %}
+            <div class="poll">
+                <p>{{poll.question}}</p>
+                <ul>
+                {% for item in poll.items.all %}
+                    <li>
+                        {{item.content}}
+                        <div class="poll-bar"><div class="poll-bar-inner" style="width:{{item.vote_ratio|stringformat:"f"}}%;"></div>
+                    </li>
+                {% endfor %}
+                </ul>
+            </div>
+        {% endif %}
+    {% else %}
+        <div class="poll">
+            <p>{{poll.question}}</p>
+            <form action="{{poll.get_absolute_url}}" method="post">{% ssi_csrf_token %}
+            {{ form.vote }}
+            <input type="submit" value="{% trans "Submit" %}" />
+            </form>
+        </div>
+    {% endif %}
+{% endif %}
\ No newline at end of file