Source

django-poll-system / poll / templates / polls.html

Full commit
{% load i18n %}
{% load polls_tags %}

{% if poll %}
<style type="text/css">
	{% include "_polls_style.css" %}
</style>
<script type="text/javascript">
	{% include "_polls_script.js" %}
</script>

<div id="poll_content_{{ poll.pk }}">
	<p id="poll_warning_message">
		<noscript>		
			{% trans "WARNING: JavaScript is disabled in your browser. Please, turn it on to vote." %}
		</noscript>
	</p>
	<form method="post">
		{% csrf_token %}
		<h1><span id="poll_title">{% trans "Poll" %}:</span> {{ poll.title }}</h1>
		{% if user.is_authenticated %}
		<div id="poll_userspace">
			{% trans "User" %}: {{ user }}
		</div>
		{% endif %} 
		<div id="poll_body">
			{% if poll.get_cookie_name in request.COOKIES %}
				<p>{% trans "You already voted" %}.</p>
				<p><a id="showresults_{{ poll.pk }}" href="javascript:void(0);">{% trans "Show results" %}</a></p>
			{% else %}
				{% render_items poll items %}
				<p><input id="sendvote_{{ poll.pk }}" type="button" value="{% trans "Vote" %}" /></p>
			{% endif %}
		</div>
	</form>
	<script type="text/javascript">
		if(!navigator.cookieEnabled) {
			$('#poll_content_{{ poll.pk }} #poll_warning_message').append('{% trans "WARNING: Cookies are disabled in your browser. Please, turn it on to vote." %}');
			$('#sendvote_{{ poll.pk }}').attr('disabled', '');
		}
	</script>
</div>
{% endif %}