# HG changeset patch # User Brian Neal # Date 1463021354 18000 # Node ID f7554fb887271f0e98ba8c26be883ec2051c826c # Parent 71685387dd11752f6216463b0c9273b3911b7e75 Update polls app to V3 design. diff -r 71685387dd11 -r f7554fb88727 polls/static/css/polls.css --- a/polls/static/css/polls.css Mon May 09 19:48:51 2016 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -.poll-form { - padding-bottom: 1em; -} -.poll-form ul { - list-style: none; - padding-bottom: 0.5em; -} -.poll-form li { - padding: 0.5em 0 0.5em 0.5em; -} -dl.poll-result { - width: 80%; -} diff -r 71685387dd11 -r f7554fb88727 polls/views.py --- a/polls/views.py Mon May 09 19:48:51 2016 -0500 +++ b/polls/views.py Wed May 11 21:49:14 2016 -0500 @@ -61,6 +61,7 @@ return render(request, 'polls/index.html', { 'current_polls': current_polls, 'old_polls': old_polls, + 'V3_DESIGN': True, }) ####################################################################### @@ -77,6 +78,7 @@ 'total_votes': total_votes, 'choices': choices, 'user_choice': get_user_choice(request.user, poll), + 'V3_DESIGN': True, }) ####################################################################### @@ -106,6 +108,7 @@ 'poll': poll, 'vote_form': vote_form, 'user_choice': user_choice, + 'V3_DESIGN': True, }) ####################################################################### diff -r 71685387dd11 -r f7554fb88727 sg101/templates/polls/index.html --- a/sg101/templates/polls/index.html Mon May 09 19:48:51 2016 -0500 +++ b/sg101/templates/polls/index.html Wed May 11 21:49:14 2016 -0500 @@ -1,5 +1,4 @@ -{% extends 'base.html' %} -{% load comment_tags %} +{% extends 'v3/base.html' %} {% block title %}Polls{% endblock %} {% block content %}

Polls

diff -r 71685387dd11 -r f7554fb88727 sg101/templates/polls/poll_detail.html --- a/sg101/templates/polls/poll_detail.html Mon May 09 19:48:51 2016 -0500 +++ b/sg101/templates/polls/poll_detail.html Wed May 11 21:49:14 2016 -0500 @@ -1,39 +1,46 @@ -{% extends 'base.html' %} +{% extends 'v3/base.html' %} {% load comment_tags %} {% load script_tags %} {% load static from staticfiles %} {% block title %}Poll Results: {{ poll.question }}{% endblock %} +{% block pre_custom_css %} +{% css_tags 'jquery-ui markitup' %} +{% endblock %} {% block custom_css %} - {% endblock %} -{% block custom_js %} -{% if poll.is_open %} -{% script_tags "markitup jquery-ui" %} - -{% endif %} -{% endblock %} + {% block content %} -

Polls

-

Results for: {{ poll.question }}

+ +

Results for: {{ poll.question }}

{% for choice in choices %}
{{ choice.choice }} - {{ choice.pct|floatformat }}% ({{ choice.votes }} vote{{ choice.votes|pluralize }})
-
-  
+
+
+
{% endfor %}

{{ total_votes }} total vote{{ total_votes|pluralize }}.

{% if user_choice %} -

You voted for "{{ user_choice.choice }}".

+
+ You voted for "{{ user_choice.choice }}". +
{% endif %}

{% if poll.is_open %} -Voting for this poll started on {{ poll.start_date|date:"F d, Y" }}. +Voting for this poll started on {{ poll.start_date|date:"F d, Y" }}. {% if poll.end_date %} Voting will end on {{ poll.end_date|date:"F d, Y" }}. {% endif %} @@ -42,12 +49,15 @@ {% endif %}

-

+

{% if poll.is_open and user.is_authenticated %} -Vote | + {% if user_choice %} + Delete My Vote + {% else %} + Vote + {% endif %} {% endif %} -All Polls -

+
{% get_comment_count for poll as comment_count %}

This poll has {{ comment_count }} comment{{ comment_count|pluralize }}.

@@ -57,7 +67,14 @@

Leave a comment?

{% render_comment_form user poll %} {% else %} -

Comments are closed for this poll. If you'd like to share your thoughts on this poll +

Comments are closed for this poll. If you'd like to share your thoughts on this poll with the site staff, you can contact us directly.

{% endif %} {% endblock %} + +{% block custom_js %} + {% if poll.is_open %} + {% js_tags "markitup jquery-ui" %} + + {% endif %} +{% endblock %} diff -r 71685387dd11 -r f7554fb88727 sg101/templates/polls/poll_vote.html --- a/sg101/templates/polls/poll_vote.html Mon May 09 19:48:51 2016 -0500 +++ b/sg101/templates/polls/poll_vote.html Wed May 11 21:49:14 2016 -0500 @@ -1,31 +1,37 @@ -{% extends 'base.html' %} +{% extends 'v3/base.html' %} {% load static from staticfiles %} {% block title %}Polls: {{ poll.question }}{% endblock %} -{% block custom_css %} - -{% endblock %} {% block content %} -

Poll

-

Voting Booth: {{ poll.question }}

+ +

{{ poll.question }}

{% if user_choice %} -

You voted for "{{ user_choice.choice }}".

-
{% csrf_token %} -
+
+ You previously voted for "{{ user_choice.choice }}". +
+ {% csrf_token %} - -
-
+ + {% else %}
{% csrf_token %} -
- {{ vote_form.as_p }} - -
+ {% if vote_form.non_field_errors %} + {{ form.non_field_errors }} + {% endif %} + {% if vote_form.choices.errors %} + {{ vote_form.choices.errors }} + {% endif %} + +
{% endif %} -

-View results -| All polls -

-

This poll was published on {{ poll.start_date|date:"F d, Y" }}.

{% endblock %}