Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: agency index #430

Merged
merged 5 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions benefits/core/templates/core/agency_index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends 'core/page.html' %}
{% load i18n %}

{% block container_content %}
<h1>{{ page.content_title }}</h1>

<p>{% blocktranslate with info_link=info_link%}core.pages.agency_index.p[0]{{ info_link }}{% endblocktranslate %}</p>
<p>{% translate "core.pages.agency_index.p[1]" %}</p>

{% block buttons%}
{{ block.super }}
{% endblock buttons %}

{% endblock container_content %}
13 changes: 9 additions & 4 deletions benefits/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,19 @@ def agency_index(request, agency):
session.reset(request)
session.update(request, agency=agency, origin=agency.index_url)

button = viewmodels.Button.primary(text=_("core.pages.index.continue"), url=reverse("eligibility:index"))
button.label = _("core.pages.agency_index.button.label")

page = viewmodels.Page(
content_title=_index_content_title(),
paragraphs=_index_paragraphs(),
button=viewmodels.Button.primary(text=_("core.pages.index.continue"), url=reverse("eligibility:index")),
content_title=_("core.pages.agency_index.content_title"),
button=button,
classes="home",
)

return PageTemplateResponse(request, page)
help_page = reverse("core:help")
context_dict = {**page.context_dict(), **{"info_link": f"{help_page}#about"}}

return TemplateResponse(request, "core/agency_index.html", context_dict)


@middleware.pageview_decorator
Expand Down
19 changes: 18 additions & 1 deletion benefits/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,23 @@ msgstr ""
"The new way to pay for transit makes it easier to get your discount every "
"time you ride"

msgid "core.pages.agency_index.content_title"
msgstr ""
"Cal-ITP Benefits makes it easy to use your public transit discount "
"every time you ride."

msgid "core.pages.agency_index.p[0]%(info_link)s"
msgstr "With new contactless payment options, you can tap "
"your bank-issued contactless credit or debit card when you "
"board, and your discount will automatically apply every "
"time you ride. <a href=\"%(info_link)s\">Learn more about Cal-ITP Benefits.</a>"

msgid "core.pages.agency_index.p[1]"
msgstr "The Cal-ITP Benefits program is currently only open to those <strong>ages 65 or older</strong>."

msgid "core.pages.agency_index.button.label"
msgstr "Verify your discount and connect your bank card today!"

#: benefits/core/views.py:25
msgctxt "image alt text"
msgid "core.pages.index.image"
Expand Down Expand Up @@ -273,7 +290,7 @@ msgstr "Choose your transit provider"

#: benefits/core/views.py:70
msgid "core.pages.index.continue"
msgstr "Let’s do it!"
msgstr "Get started"
machikoyasuda marked this conversation as resolved.
Show resolved Hide resolved

#: benefits/core/views.py:86 benefits/core/views.py:106
msgid "core.buttons.back"
Expand Down
17 changes: 17 additions & 0 deletions benefits/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,23 @@ msgstr ""
"La nueva forma de pagar el transporte público hace que sea más fácil obtener "
"su descuento cada vez que viaja"

msgid "core.pages.agency_index.content_title"
angela-tran marked this conversation as resolved.
Show resolved Hide resolved
msgstr ""
"TODO: Cal-ITP Benefits makes it easy to use your public transit discount "
"every time you ride."

msgid "core.pages.agency_index.p[0]%(info_link)s"
msgstr "TODO: With new contactless payment options, you can tap "
"your bank-issued contactless credit or debit card when you "
"board, and your discount will automatically apply every "
"time you ride. <a href=\"%(info-link)s\">Learn more about Cal-ITP Benefits.</a>"

msgid "core.pages.agency_index.p[1]"
msgstr "TODO: The Cal-ITP Benefits program is currently only open to those <strong>ages 65 or older</strong>."

msgid "core.pages.agency_index.button.label"
msgstr "TODO: Verify your discount and connect your bank card today!"

#: benefits/core/views.py:25
msgctxt "image alt text"
msgid "core.pages.index.image"
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/specs/feature/eligibility.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("Eligibility confirmation flow", () => {
beforeEach(() => {
cy.visit("/");
cy.contains(agencies[0].fields.short_name).click();
cy.contains("Let’s do it!").click();
cy.contains("Get started").click();
cy.contains("Continue").click();
});

Expand Down
8 changes: 4 additions & 4 deletions tests/cypress/specs/ui/eligibility.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("Single verifier: Eligibility confirmation page spec", () => {
cy.visit("/");
// Selecting DEFTl will go down the single verifier flow
cy.contains(agencies[1].fields.short_name).click();
cy.contains("Let’s do it!").click();
cy.contains("Get started").click();
cy.contains("Continue").click();
cy.url().should("include", eligibility_confirm_url);
});
Expand All @@ -20,7 +20,7 @@ describe("Multiple Verifier, no AuthProvider: Verifier selection page spec", ()
cy.visit("/");
// Selecting ABC will go down the multiple verifier flow
cy.contains(agencies[0].fields.short_name).click();
cy.contains("Let’s do it!").click();
cy.contains("Get started").click();
});

it("User can navigate to the Verifier Selection page", () => {
Expand Down Expand Up @@ -61,7 +61,7 @@ describe("Multiple verifier, no AuthProvider: Eligibility confirmation form spec
beforeEach(() => {
cy.visit("/");
cy.contains(agencies[0].fields.short_name).click();
cy.contains("Let’s do it!").click();
cy.contains("Get started").click();
cy.get("input:radio").last().click();
cy.contains("Continue").click();
cy.contains("You’ll need two things before we get started:");
Expand Down Expand Up @@ -90,7 +90,7 @@ describe("Multiple verifier, with AuthProvider: Eligibility start page spec", ()
beforeEach(() => {
cy.visit("/");
cy.contains(agencies[0].fields.short_name).click();
cy.contains("Let’s do it!").click();
cy.contains("Get started").click();
cy.get("input:radio").first().click();
cy.contains("Continue").click();
cy.url().should("include", eligibility_start_url);
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/specs/ui/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Index page spec", () => {
it("Clicking transit option link takes user to a transit provider page", () => {
cy.contains(agencies[0].fields.short_name).click();

cy.contains("Let’s do it!").then(($e) => {
cy.contains("Get started").then(($e) => {
expect($e).attr("href").to.include("/eligibility");
});
});
Expand Down