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

Feat: CalFresh enrollment success with expiration #1988

Merged
merged 5 commits into from
Apr 29, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions benefits/enrollment/templates/enrollment/success.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,25 @@

{% block headline %}
<div class="col-lg-8">
<h1 class="pb-lg-5 pb-4">{% translate "Success! Your transit benefit is now connected to your card." %}</h1>
<h1 class="pb-lg-4 mb-lg-3 pb-4">{% translate "Success! Your transit benefit is now connected to your card." %}</h1>
</div>
{% endblock headline %}

{% block inner-content %}
<div class="col-12 col-sm-12 col-lg-9">
<div class="row flex-column-reverse flex-lg-row">
<div class="col-12 col-lg-7">
<p class="pt-lg-4 mt-lg-3">
{% block success-message %}
{% endblock success-message %}
</p>
{# djlint:off #}
{% if enrollment.supports_expiration %}
<h2 class="h3 mt-lg-3 mb-1">{% translate "Your benefit will expire on" %} {{ enrollment.expires|date }}.</h2>
<p>
{% else %}
<p class="pt-lg-4 mt-lg-3">
{% endif %}
{% block success-message %}
{% endblock success-message %}
</p>
{# djlint:on #}
<p class="pt-4">{% translate "Thank you for using Cal-ITP Benefits!" %}</p>
</div>
<div class="col-12 col-lg-5">
Expand Down
Empty file added benefits/locale/__init__.py
Empty file.
5 changes: 4 additions & 1 deletion benefits/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
"POT-Creation-Date: 2024-04-25 14:33-0700\n"
"POT-Creation-Date: 2024-04-26 16:57+0000\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -637,6 +637,9 @@ msgstr ""
msgid "Success! Your transit benefit is now connected to your card."
msgstr ""

msgid "Your benefit will expire on"
msgstr ""

msgid "Thank you for using Cal-ITP Benefits!"
msgstr ""

Expand Down
Empty file.
2 changes: 2 additions & 0 deletions benefits/locale/en/formats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#date-and-time-formatting-specifiers
DATE_FORMAT = "F j, Y"
5 changes: 4 additions & 1 deletion benefits/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
"POT-Creation-Date: 2024-04-25 14:33-0700\n"
"POT-Creation-Date: 2024-04-26 16:57+0000\n"
"Language: Español\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -763,6 +763,9 @@ msgstr "Éxito"
msgid "Success! Your transit benefit is now connected to your card."
msgstr "¡Éxito! Su beneficio de tránsito ahora está conectado a su tarjeta."

msgid "Your benefit will expire on"
msgstr ""

msgid "Thank you for using Cal-ITP Benefits!"
msgstr "¡Gracias por usar Cal-ITP Benefits!"

Expand Down
Empty file.
5 changes: 5 additions & 0 deletions benefits/locale/es/formats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Both “d” and “e” are backslash-escaped, because otherwise each is a format string
# that displays the day and the timezone name, respectively.
# Instead we want the literal word "de"
# https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#date-and-time-formatting-specifiers
DATE_FORMAT = r"j \d\e F \d\e Y"
5 changes: 5 additions & 0 deletions benefits/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ def RUNTIME_ENVIRONMENT():
TIME_ZONE = "UTC"
USE_TZ = True

# https://docs.djangoproject.com/en/5.0/topics/i18n/formatting/#creating-custom-format-files
FORMAT_MODULE_PATH = [
"benefits.locale",
]

# Static files (CSS, JavaScript, Images)

STATIC_URL = "/static/"
Expand Down
Empty file added tests/__init__.py
Empty file.
Empty file added tests/pytest/__init__.py
Empty file.
Empty file.
36 changes: 36 additions & 0 deletions tests/pytest/locale/test_formats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from datetime import datetime

import pytest

from django.utils.formats import date_format

from benefits.locale.en.formats import DATE_FORMAT as DATE_FORMAT_EN
from benefits.locale.es.formats import DATE_FORMAT as DATE_FORMAT_ES


@pytest.fixture
def date_december():
return datetime(2024, 12, 1)


@pytest.fixture
def date_march():
return datetime(2024, 3, 1)


def test_en_DATE_FORMAT_december(date_december):
assert date_format(date_december, DATE_FORMAT_EN) == "December 1, 2024"


def test_en_DATE_FORMAT_march(date_march):
assert date_format(date_march, DATE_FORMAT_EN) == "March 1, 2024"


def test_es_DATE_FORMAT_december(settings, date_december):
settings.LANGUAGE_CODE = "es"
assert date_format(date_december, DATE_FORMAT_ES) == "1 de diciembre de 2024"


def test_es_DATE_FORMAT_march(settings, date_march):
settings.LANGUAGE_CODE = "es"
assert date_format(date_march, DATE_FORMAT_ES) == "1 de marzo de 2024"