Skip to content

Commit

Permalink
Review split person choices
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley committed May 30, 2024
1 parent 480e237 commit 74bc6f5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 23 deletions.
5 changes: 4 additions & 1 deletion ynr/apps/candidates/views/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,14 @@ def post(self, request, *args, **kwargs):


class ReviewPersonSplitView(TemplateView):
template_name = "review_split_person.html"
template_name = "people/review_split_person.html"

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["choices"] = self.request.session.get("choices", {})
context["person"] = get_object_or_404(
Person, pk=self.request.session.get("person_id")
)
return context


Expand Down
56 changes: 34 additions & 22 deletions ynr/apps/people/templates/people/review_split_person.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,40 @@
{% load pipeline %}

{% block content %}
<h1>Review Person split choices</h1>
<h2>Keep</h2>
<ul>
{% for item in choices.keep %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<h2>Move</h2>
<ul>
{% for item in choices.move %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<h2>Both</h2>
<ul>
{% for item in choices.both %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<form action="{% url 'submit_choices' %}" method="post">
<h1>Review split person choices</h1>

{% if choices.keep %}
<h2>Keep these attributes on <a href="{% url 'person-view' person_id %}">Person:# {{person_id}}</a></h2>
<ul>
{% for item in choices.keep %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<p>Submitting this form will create a new person with the above attributes.</p>
{% endif %}

{% if choices.move %}
<h2>Move these attributes to a new Person</h2>
<ul>
{% for item in choices.move %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<p>Submitting this form will create a new person with the above attributes and remove the above attributes from the original person.</p>
{% endif %}

{% if choices.both %}
<h2>Do both</h2>
<ul>
{% for item in choices.both %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<p>Submitting this form will create a new person with the above attributes and keep the above attributes on the original person.</p>
{% endif %}
<form method="post" action="{% url 'confirm_split_person' person_id %}">
{% csrf_token %}
<button type="submit">Submit Choices</button>
<input class="button primary small" type="submit" value="Submit choices">
</form>

<a class="button secondary small" onclick="window.history.back()">Go back</a>
{% endblock %}
5 changes: 5 additions & 0 deletions ynr/apps/people/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
views.ReviewPersonSplitView.as_view(),
name="review_split_person",
),
re_path(
r"^person/(?P<person_id>\d+)/confirm_split/?$",
views.ConfirmPersonSplitView.as_view(),
name="confirm_split_person",
),
re_path(
r"^person/create/select_election$",
views.NewPersonSelectElectionView.as_view(),
Expand Down

0 comments on commit 74bc6f5

Please sign in to comment.