Skip to content

Commit

Permalink
Have closed staff and dealer pages return back to reg index
Browse files Browse the repository at this point in the history
We'll revert staff and dealer closed pages back to having them send the
user to the registration index, which from there they can decide whether
they want to continue to the registration process. If the registration
page is closed and the website url is set, then the user can click "Back
to Main Page" go back to the website's main URL.
  • Loading branch information
staticfox committed Jan 14, 2025
1 parent a4e2ac9 commit af57cd5
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h1>Dealer Registration - {{ event }}</h1>
<p>Dealer registration for {{ event }} {{ message }}</p>
<p>If you have any questions please contact
<a href='mailto:{{ event.dealerEmail }}'>{{ event.dealerEmail }}</a></p>
<p style='float:right;'><a href="{{ homeRedirect }}">Back to Main Page</a></p>
<p style='float:right;'><a href="{% url 'registration:index' %}">Back to Main Page</a></p>
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1>Staff Registration - {{ event }}</h1>
<a href="mailto:{{ event.staffEmail }}">{{ event.staffEmail }}</a>
</p>
<p style="float:right;">
<a href="{{ homeRedirect }}">Back to Main Page</a>
<a href="{% url 'registration:index' %}">Back to Main Page</a>
</p>
</div>
</div>
Expand Down
15 changes: 0 additions & 15 deletions registration/tests/test_dealers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,13 @@ def test_addNewDealer_closed_upcoming(self) -> None:
self.assertIn(b"not yet open", response.content)
self.assertIn(b'<a href="/registration/">Back to Main Page</a>', response.content)

self.event.websiteUrl = "https://example.com"
self.event.save()

response = self.client.get(reverse("registration:new_dealer"))
self.assertEqual(response.status_code, 200)
self.assertIn(b'<a href="https://example.com">Back to Main Page</a>', response.content)

@freeze_time(timezone.now() + timedelta(days=20))
def test_addNewDealer_closed_ended(self) -> None:
response = self.client.get(reverse("registration:new_dealer"))
self.assertEqual(response.status_code, 200)
self.assertIn(b"has ended", response.content)
self.assertIn(b'<a href="/registration/">Back to Main Page</a>', response.content)

event = Event.objects.get(default=True)
event.websiteUrl = "https://example.com"
event.save()

response = self.client.get(reverse("registration:new_dealer"))
self.assertEqual(response.status_code, 200)
self.assertIn(b'<a href="https://example.com">Back to Main Page</a>', response.content)

def test_find_dealer_to_add_assistant(self):
response = self.client.get(
reverse("registration:find_dealer_to_add_assistant", args=("FOOBAR",))
Expand Down
14 changes: 0 additions & 14 deletions registration/tests/test_staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,6 @@ def test_new_staff_invite_good_closed_upcoming(self):
self.assertIn(b"not yet open", response.content)
self.assertIn(b'<a href="/registration/">Back to Main Page</a>', response.content)

self.event.websiteUrl = "https://example.com"
self.event.save()

response = self.client.get(reverse("registration:new_dealer"))
self.assertEqual(response.status_code, 200)
self.assertIn(b'<a href="https://example.com">Back to Main Page</a>', response.content)

@freeze_time(timezone.now() + timedelta(days=20))
def test_new_staff_invite_good_closed_ended(self):
body = {
Expand All @@ -157,13 +150,6 @@ def test_new_staff_invite_good_closed_ended(self):
self.assertIn(b"has ended", response.content)
self.assertIn(b'<a href="/registration/">Back to Main Page</a>', response.content)

self.event.websiteUrl = "https://example.com"
self.event.save()

response = self.client.get(reverse("registration:new_dealer"))
self.assertEqual(response.status_code, 200)
self.assertIn(b'<a href="https://example.com">Back to Main Page</a>', response.content)

@freeze_time("2000-01-01")
def test_new_staff_invite_override(self):
body = {
Expand Down
6 changes: 0 additions & 6 deletions registration/views/dealers.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ def new_dealer(request):
tz = timezone.get_current_timezone()
today = tz.localize(datetime.now())
context = {"event": event, "venue": venue}

if event.websiteUrl:
context["homeRedirect"] = event.websiteUrl
else:
context["homeRedirect"] = reverse("registration:index")

if event.dealerRegStart <= today <= event.dealerRegEnd:
return render(request, "registration/dealer/dealer-form.html", context)
elif event.dealerRegStart >= today:
Expand Down
13 changes: 0 additions & 13 deletions registration/views/staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django.forms import model_to_dict
from django.http import JsonResponse
from django.shortcuts import render
from django.urls import reverse
from django.views.decorators.http import require_POST

import registration.emails
Expand All @@ -32,12 +31,6 @@ def new_staff(request, guid):
tz = timezone.get_current_timezone()
today = tz.localize(datetime.now())
context = {"token": guid, "event": event}

if event.websiteUrl:
context["homeRedirect"] = event.websiteUrl
else:
context["homeRedirect"] = reverse("registration:index")

if event.staffRegStart <= today <= event.staffRegEnd or invite.ignore_time_window is True:
return render(request, "registration/staff/staff-new.html", context)
elif event.staffRegStart >= today:
Expand Down Expand Up @@ -173,12 +166,6 @@ def staff_index(request, guid):
tz = timezone.get_current_timezone()
today = tz.localize(datetime.now())
context = {"token": guid, "event": event}

if event.websiteUrl:
context["homeRedirect"] = event.websiteUrl
else:
context["homeRedirect"] = reverse("registration:index")

if event.staffRegStart <= today <= event.staffRegEnd:
return render(request, "registration/staff/staff-locate.html", context)
elif event.staffRegStart >= today:
Expand Down

0 comments on commit af57cd5

Please sign in to comment.