From 9591084f49bce322e4a3b70bea935e720ff9daab Mon Sep 17 00:00:00 2001 From: Felix Sargent Date: Tue, 23 Jul 2024 16:12:15 -0700 Subject: [PATCH] Improve formatting to be consistent with bootstrap 5 --- approval_polls/staticfiles/scss/custom.scss | 4 +- approval_polls/templates/base.html | 120 +++++++-------- approval_polls/templates/index.html | 80 ++++++---- approval_polls/templates/my_info.html | 159 +++++++++++--------- approval_polls/templates/my_polls.html | 102 +++++++------ approval_polls/templates/results.html | 80 ++++------ 6 files changed, 279 insertions(+), 266 deletions(-) diff --git a/approval_polls/staticfiles/scss/custom.scss b/approval_polls/staticfiles/scss/custom.scss index 0edfbac..c94a3f9 100644 --- a/approval_polls/staticfiles/scss/custom.scss +++ b/approval_polls/staticfiles/scss/custom.scss @@ -3,8 +3,8 @@ $primary: #000000; $secondary: #ffffff; $success: #000000; $info: #ffffff; -$warning: #000000; -$danger: #000000; +$warning: #aa4a44; +$danger: #aa4a44; $light: #ffffff; $dark: #000000; diff --git a/approval_polls/templates/base.html b/approval_polls/templates/base.html index c31a9a5..be714a2 100644 --- a/approval_polls/templates/base.html +++ b/approval_polls/templates/base.html @@ -52,84 +52,74 @@ {% load tz %} {% get_current_timezone as TIME_ZONE %} - -
-
- {% block content %} - {% endblock content %} -
-
-
-

+ + +

+ {% block content %} + {% endblock content %} +
+
+ + + {% block extra_js %}{% endblock %} diff --git a/approval_polls/templates/index.html b/approval_polls/templates/index.html index 3c60509..6e32812 100644 --- a/approval_polls/templates/index.html +++ b/approval_polls/templates/index.html @@ -1,36 +1,60 @@ {% extends 'base.html' %} {% block content %} - {% if latest_poll_list %} -
-
-

Latest Public Polls

- {% for poll in latest_poll_list %} -
- {{ poll.question }} -

Published on {{ poll.pub_date|date:"N j, Y, P e" }} by {% firstof poll.user.username poll.user.first_name %}

-
- {% endfor %} +
+ {% if latest_poll_list %} +

Latest Public Polls

+
+
+ {% for poll in latest_poll_list %} +
+
+

+ {{ poll.question }} +

+

+ Published on {{ poll.pub_date|date:"N j, Y, P e" }} by {% firstof poll.user.username poll.user.first_name %} +

+
+
+ {% endfor %} +
-
-
-
-
+
-
-
- {% else %} -
-
-

No polls are available.

-
-
- {% endif %} +
  • + Page {{ latest_poll_list.number }} of {{ latest_poll_list.paginator.num_pages }} +
  • + {% if latest_poll_list.has_next %} +
  • + + Next + +
  • + {% endif %} + + + {% else %} + + {% endif %} +
    {% endblock content %} {% block footer %} - Create a Poll +
    +
    + +
    +
    {% endblock %} diff --git a/approval_polls/templates/my_info.html b/approval_polls/templates/my_info.html index cfa328d..275c0c0 100644 --- a/approval_polls/templates/my_info.html +++ b/approval_polls/templates/my_info.html @@ -1,85 +1,98 @@ {% extends 'base.html' %} -{% block head %} - {% load static %} +{% load static %} +{% block extra_css %}{% endblock %} +{% block extra_js %} {% endblock %} {% block content %} -
    -
    -

    My User Profile

    -
    -
    -
    -
    -
    - {% comment %}

    First Name: {{ current_user.first_name }}

    -

    Last Name: {{ current_user.last_name }}

    {% endcomment %} -

    Email: {{ current_user.email }}

    -

    Member since: {{ current_user.date_joined|date:"F j, Y e" }}

    -

    Last Login: {{ current_user.last_login|date:"F j, Y e" }}

    -

    - Polls I created: - {{ current_user.poll_set.all.count }} -

    -

    - Change Username -

    -

    - Change Password -

    -

    - Manage Subscriptions -

    +
    +

    My User Profile

    +
    +
    +

    Personal Information

    +
    +
    First Name:
    +
    + {{ current_user.first_name }} +
    +
    Last Name:
    +
    + {{ current_user.last_name }} +
    +
    Username:
    +
    + {{ current_user.username }} +
    +
    Email:
    +
    + {{ current_user.email }} +
    +
    Member since:
    +
    + {{ current_user.date_joined|date:"F j, Y" }} +
    +
    Last Login:
    +
    + {{ current_user.last_login|date:"F j, Y" }} +
    +
    Polls created:
    +
    + {{ current_user.poll_set.all.count }} +
    +
    +
    + Change Password + {% comment %} + Change Username + Manage Subscriptions + {% endcomment %} +
    -
    -
    -
    -

    My Polls

    -
    -
    - {% if latest_poll_list %} -
    -
    - {% for poll in latest_poll_list %} -
    -
    +

    My Polls

    + {% if latest_poll_list %} + {% for poll in latest_poll_list %} +
    +
    +

    {{ poll.question }} +

    +

    Published on {{ poll.pub_date|date:"N j, Y, P e" }}

    +
    + Edit +
    -
    - remove - {% comment %} {%with suspend_text=poll.is_suspended|get_suspend_text%} {% endcomment %} - {% comment %} {% endcomment %} - {% comment %} {{ suspend_text }} {% endcomment %} - {% comment %} {%endwith%} {% endcomment %} - edit -
    -
    - -
    -

    Published on {{ poll.pub_date|date:"N j, Y, P e" }}

    - {% endfor %} -
    -
    -
    -
    -
    +
    + {% endfor %} +
    -
    -
    - {% else %} -
    -
    -

    No polls are available.

    -
    -
    - {% endif %} +
  • + Page {{ latest_poll_list.number }} of {{ latest_poll_list.paginator.num_pages }} +
  • + {% if latest_poll_list.has_next %} +
  • + + Next + +
  • + {% endif %} + + + {% else %} + + {% endif %} + +
    {% endblock content %} diff --git a/approval_polls/templates/my_polls.html b/approval_polls/templates/my_polls.html index 97b4806..4acf887 100644 --- a/approval_polls/templates/my_polls.html +++ b/approval_polls/templates/my_polls.html @@ -1,57 +1,65 @@ {% extends 'base.html' %} +{% load static %} {% load filters %} -{% block head %} - {% load static %} +{% block extra_css %}{% endblock %} +{% block extra_js %} {% endblock %} {% block content %} -
    -
    -

    My Polls

    -
    -
    - {% if latest_poll_list %} -
    -
    - {% for poll in latest_poll_list %} - -
    - remove - {% comment %} {% with suspend_text=poll.is_suspended|get_suspend_text %} - {{ suspend_text }} - {% endwith %} {% endcomment %} - edit -
    -
    - +
    +

    My Polls

    + {% if latest_poll_list %} +
    +
    + {% for poll in latest_poll_list %} +
    +
    +
    + {{ poll.question }} +
    +

    Published on {{ poll.pub_date|date:"N j, Y, P e" }}

    +
    + Edit + {% comment %} + {% with suspend_text=poll.is_suspended|get_suspend_text %} + + {% endwith %} + {% endcomment %} + +
    +
    -

    Published on {{ poll.pub_date|date:"N j, Y, P e" }}

    -
    - {% endfor %} + {% endfor %} +
    -
    -
    -
    -
    +
    -
    -
    - {% else %} -
    -
    -

    No polls are available.

    -
    -
    - {% endif %} +
  • + Page {{ latest_poll_list.number }} of {{ latest_poll_list.paginator.num_pages }} +
  • + {% if latest_poll_list.has_next %} +
  • + + Next + +
  • + {% endif %} + + + {% else %} + + {% endif %} + +
    {% endblock content %} diff --git a/approval_polls/templates/results.html b/approval_polls/templates/results.html index 7c68f90..0d6a77a 100644 --- a/approval_polls/templates/results.html +++ b/approval_polls/templates/results.html @@ -1,65 +1,43 @@ {% extends 'base.html' %} {% load filters %} {% block content %} -
    -
    -

    {{ poll.question }}

    +
    +

    {{ poll.question }}

    +
    +

    + {{ poll.total_ballots }} ballot{{ poll.total_ballots|pluralize }} + {% if poll.is_closed and poll.total_votes == 0 %}No votes in this poll{% endif %} +

    -
    -
    -
    -

    - - {{ poll.total_ballots }} - ballot{{ poll.total_ballots|pluralize }} - {% if poll.is_closed and poll.total_votes == 0 %}

    No votes in this poll

    {% endif %} -
    -

    -
    -
    -
    -
    +
    {% for choice in poll.choice_set.all|sort_by_votes %} -

    - {{ choice.choice_text }} - {% if poll.is_closed and choice in leading_choices %} - - Winner - +
    +

    + {{ choice.choice_text }} + {% if poll.is_closed and choice in leading_choices %} + + Winner - - {% endif %} - {{ choice.votes }} vote{{ choice.votes|pluralize }} ({{ choice.percentage|to_percent_str }}) -

    -
    - {% if poll.show_lead_color %} - {% if choice in leading_choices %} -
    - {% else %} -
    {% endif %} - {% else %} -
    +

    {{ choice.votes }} vote{{ choice.votes|pluralize }} ({{ choice.percentage|to_percent_str }})

    +
    +
    - {% endif %} + style="width: {% widthratio choice.percentage 1 100 %}%" + aria-valuenow="{% widthratio choice.percentage 1 100 %}" + aria-valuemin="0" + aria-valuemax="100">
    +
    {% endfor %}
    -

    -
    -
    -
    - {% if 'invitation' in request.META.HTTP_REFERER %} - Back to poll - {% else %} - Back to poll - {% endif %} -
    +
    + {% if 'invitation' in request.META.HTTP_REFERER %} + Back to poll + {% else %} + Back to poll + {% endif %}
    {% endblock %}