Skip to content

Commit

Permalink
Tests all pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
fsargent committed Jun 6, 2024
1 parent 0112fb5 commit 47ea386
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 119 deletions.
2 changes: 1 addition & 1 deletion approval_polls/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __str__(self):
class Ballot(models.Model):
poll = models.ForeignKey(Poll, on_delete=models.CASCADE, null=True, blank=True)
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
timestamp = models.DateTimeField("time voted")
timestamp = models.DateTimeField("time voted", auto_now_add=True)
permit_email = models.BooleanField(default=False)
email = models.EmailField(null=True, blank=True)

Expand Down
2 changes: 1 addition & 1 deletion approval_polls/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
{% block login %}
{% if user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="{% url 'my_info' %}">{{ user.username }}</a>
<a class="nav-link" href="{% url 'my_info' %}">{% firstof user.username "My Profile"%}</a>
</li>
<li class="nav-item">
<a class="nav-link"
Expand Down
6 changes: 1 addition & 5 deletions approval_polls/templates/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ <h3>{{ poll.question }}</h3>
id='choice{{ forloop.counter }}'
{% if checked_choices %} {% if choice in checked_choices %}checked{% endif %}
{% endif %}>
{% if choice.choice_link %}
<a href={{ choice.choice_link }} target='_blank'>{{ choice.choice_text }}</a>
{% else %}
{{ choice.choice_text }}
{% endif %}
</label>
</label>
</div>
{% endfor %}
{% if poll.show_write_in and not poll.is_closed %}
Expand Down
33 changes: 11 additions & 22 deletions approval_polls/templates/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,38 +57,27 @@ <h5 style="color:#8B0000;">
{% with choice_id=choice.id %}
{% with box_text=existing_choice_texts_existing|get_item:choice_id %}
{% with link_text=existing_choice_links_existing|get_item:choice_id %}
<div class='form-group {% if choice.id in blank_choices %}has-error{% endif %}'>
<div class="form-group {% if choice.id in blank_choices %}has-error{% endif %}">
{% if choice_blank_error and choice_id in blank_choices %}
<label class='control-label' for='choice{{ choice_id }}'>
<label class="control-label" for="choice{{ choice_id }}">
Please ensure you have a value for the choice or remove it.
</label>
{% endif %}
<div class='input-group' id='div-choice{{ choice.pk }}'>
<input class='form-control' type='text' maxlength='200' name='choice{{ choice.pk }}' placeholder='Choice' value="{% if choice_id in blank_choices %}" {% else %} {{ box_text|default:choice.choice_text }} {% endif %} {% if not can_edit_poll %}disabled{% endif %}>
<div class="input-group" id="div-choice{{ choice.pk }}">
<input class="form-control" type="text" maxlength="200" name="choice{{ choice.pk }}" placeholder="Choice" value="{% if choice_id in blank_choices %}{% else %}{{ box_text|default:choice.choice_text }}{% endif %}" {% if not can_edit_poll %}disabled{% endif %}>
{% if can_edit_poll %}
<span class='input-group-addon'>
<a href='#'
class='add-link'
id='link-choice{{ choice.pk }}'
title='Add link'
data-toggle='tooltip'
data-placement='bottom'>
<span class='glyphicon glyphicon-link {% if link_text or choice.choice_link %}text-success{% endif %}'></span>
<span class="input-group-addon">
<a href="#" class="add-link" id="link-choice{{ choice.pk }}" title="Add link" data-toggle="tooltip" data-placement="bottom">
<span class="glyphicon glyphicon-link {% if link_text or choice.choice_link %}text-success{% endif %}"></span>
</a>
</span>
<span class='input-group-addon'>
<a href='#'
class='remove-choice'
id='remove-choice{{ choice.pk }}'
title='Remove Choice'>
<span class='glyphicon glyphicon-remove'></span>
<span class="input-group-addon">
<a href="#" class="remove-choice" id="remove-choice{{ choice.pk }}" title="Remove Choice">
<span class="glyphicon glyphicon-remove"></span>
</a>
</span>
{% endif %}
<input type='hidden'
id='linkurl-choice{{ choice.pk }}'
name='linkurl-choice{{ choice.pk }}'
value='{{ link_text|default:choice.choice_link }}'>
<input type="hidden" id="linkurl-choice{{ choice.pk }}" name="linkurl-choice{{ choice.pk }}" value="{{ link_text|default:choice.choice_link }}">
</div>
</div>
{% endwith %}
Expand Down
10 changes: 5 additions & 5 deletions approval_polls/templates/my_info.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{% extends 'base.html' %}
{% block head %}
{% load static %}
<script src='{% static 'my_polls.js' %}'></script>
<script src="{% static 'my_polls.js' %}"></script>
{% endblock %}
{% block content %}
<div class='row-fluid top-buffer'>
<div class='col-md-12'>
<h3>My User Profile ({{ current_user.username }})</h3>
<h3>My User Profile</h3>
</div>
</div>
<div class='row-fluid top-buffer'>
<div class='col-md-12'>
<div class='well well-sm'>
<p>First Name: {{ current_user.first_name }}</p>
<p>Last Name: {{ current_user.last_name }}</p>
<p>Email: {{ current_user.email }}</p>
{% comment %} <p>First Name: {{ current_user.first_name }}</p>
<p>Last Name: {{ current_user.last_name }}</p> {% endcomment %}
<p> Email: {{ current_user.email }}</p>
<p>Member since: {{ current_user.date_joined|date:"F j, Y e" }}</p>
<p>Last Login: {{ current_user.last_login|date:"F j, Y e" }}</p>
<p>
Expand Down
6 changes: 3 additions & 3 deletions approval_polls/templates/my_polls.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ <h3>My Polls</h3>
<div class='row-fluid top-buffer full-height'>
<div class='col-md-13'>
{% for poll in latest_poll_list %}
<div class='well well-sm' id='well{{ poll.id }}'>
<div class='well well-sm' id='well{{ poll.id }}'
<div id='pollQuestion'>
<a href="{% url 'detail' poll.id %}">{{ poll.question }}</a>
</div>
<div class="pull-right">
<a class='pull-right btn btn-danger btn-xs'
id='delete-poll-{{ poll.id }}'>remove</a>
{% with suspend_text=poll.is_suspended|get_suspend_text %}
{% comment %} {% with suspend_text=poll.is_suspended|get_suspend_text %}
<a class='pull-right btn btn-warning btn-xs right-buffer'
id='{{ suspend_text }}-poll-{{ poll.id }}'>{{ suspend_text }}</a>
{% endwith %}
{% endwith %} {% endcomment %}
<a class='pull-right btn btn-primary btn-xs right-buffer'
href="{% url 'edit' poll.id %}">edit</a>
</div>
Expand Down
Loading

0 comments on commit 47ea386

Please sign in to comment.