Source

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

Rafael A 820d0ae 
















Rafael A bf119f3 

Rafael A bc2eae5 
Rafael A bf119f3 

Rafael A 820d0ae 

















Rafael A bf119f3 





Rafael A 820d0ae 
{% load i18n %}
{% load polls_tags %}

{% if poll %}
<link rel="stylesheet" href="{{ STATIC_URL }}polls/css/polls.css" />
<script type="text/javascript">
	vote_url = '{% url poll_ajax_vote poll.pk %}';
	result_url = '{% url poll_ajax_result poll.pk %}';
	poll_pk = '{{ poll.pk }}';
	poll_type = {% if poll.polltype.index == 0 %}'single'{% else %}'multiple'{% endif %};
	show_points = false;
	trans_total_voters = '{% trans "Total Voters" %}';
	trans_select_something = '{% trans "Please, choose anything to vote" %}';
</script>
<script type="text/javascript" src="{{ STATIC_URL }}polls/js/common.js"></script>

<div id="poll_content">
	<p id="warning">
		<noscript>		
			{% trans "WARNING: A JavaScript is disabled in your browser. Please, turn it on to vote." %}
		</noscript>
	</p>
	<form method="post">
		{% csrf_token %}
		<h1><span id="poll">{% 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" href="javascript:void(0);">{% trans "Show results" %}</a></p>
			{% else %}
				{% render_items poll items %}
				<p><input id="sendvote" type="button" value="{% trans "Vote" %}" /></p>
			{% endif %}
		</div>
	</form>
	<script type="text/javascript">
		if(!navigator.cookieEnabled) {
			$('#poll_content #warning').append('{% trans "WARNING: Cookies are disabled in your browser. Please, turn it on to vote." %}');
			$('#sendvote').attr('disabled', '');
		}
	</script>
</div>
{% endif %}