Skip to content

Commit

Permalink
feat: add previous page button to eligibility index if indirect entry
Browse files Browse the repository at this point in the history
  • Loading branch information
angela-tran committed Jan 20, 2023
1 parent 006ef31 commit e734280
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions benefits/eligibility/templates/eligibility/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{% extends "core/base.html" %}

{% block nav-buttons %}
{% include "core/includes/previous-page-link.html" %}
{% endblock nav-buttons %}

{% block explanatory-text %}
{% for p in page.paragraphs %}<p class="pt-4 pb-4 pb-lg-8">{{ p }}</p>{% endfor %}
{% endblock explanatory-text %}
Expand Down
12 changes: 9 additions & 3 deletions benefits/eligibility/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from . import analytics, forms, verify


ROUTE_CORE_INDEX = "core:index"
ROUTE_INDEX = "eligibility:index"
ROUTE_START = "eligibility:start"
ROUTE_LOGIN = "oauth:login"
Expand All @@ -40,10 +41,10 @@ def index(request, agency=None):
home = viewmodels.Button.home(request)
page = viewmodels.ErrorPage.user_error(button=home, path=request.path)
return TemplateResponse(request, "200_user_error.html", page.context_dict())
else:
session.update(request, eligibility_types=[], origin=agency.index_url)
else:
session.update(request, agency=agency)

session.update(request, eligibility_types=[], origin=reverse(ROUTE_INDEX))
session.update(request, agency=agency, eligibility_types=[], origin=reverse(ROUTE_CORE_INDEX))

eligibility_start = reverse(ROUTE_START)

Expand All @@ -60,6 +61,11 @@ def index(request, agency=None):
)

ctx = page.context_dict()

origin = session.origin(request)
if origin == reverse(ROUTE_CORE_INDEX):
ctx["previous_page_button"] = viewmodels.Button.previous_page(url=origin)

ctx["help_page"] = help_page
ctx["help_text"] = format_html(_("eligibility.pages.index.help_text%(help_link)s") % {"help_link": help_page})

Expand Down

0 comments on commit e734280

Please sign in to comment.