Merge remote-tracking branch 'origin/main' into 1028-move-signedouthtml-to-another-template

This commit is contained in:
Beverly Nguyen
2024-01-12 13:03:26 -08:00
10 changed files with 125 additions and 40 deletions

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1 @@
blank_issues_enabled: true

View File

@@ -0,0 +1,76 @@
name: "User Story Template"
description: "Use this template for creating user stories"
title: "User Story: [Brief description of the user story]"
labels:
- "Type: User Story"
body:
- type: markdown
attributes:
value: '**User Story:**'
- type: textarea
id: userType
attributes:
label: "As a [type of user],"
description: "Describe the type of user involved in this story."
validations:
required: true
- type: textarea
id: actionFeature
attributes:
label: "I want [an action or feature],"
description: "Describe the desired action or feature from the user's perspective."
validations:
required: true
- type: textarea
id: benefitValue
attributes:
label: "So that [benefit or value]."
description: "Describe the benefit or value the user expects from the action or feature."
validations:
required: true
- type: markdown
attributes:
value: '**Acceptance Criteria:**'
- type: textarea
id: acceptanceCriteria
attributes:
label: "Detailed condition or criteria that must be met for the user story to be considered complete."
description: "List the acceptance criteria for the user story."
validations:
required: true
- type: markdown
attributes:
value: '**Tasks:**'
- type: textarea
id: tasks
attributes:
label: "List of specific tasks or sub-tasks that need to be done to implement the user story."
description: "Outline the tasks necessary to implement the user story."
validations:
required: true
- type: markdown
attributes:
value: '**Dependencies:**'
- type: textarea
id: dependencies
attributes:
label: "List any dependencies that need to be resolved before starting or completing this user story."
description: "Specify any dependencies related to the user story."
validations:
required: false
- type: markdown
attributes:
value: '**Notes:**'
- type: textarea
id: notes
attributes:
label: "Any additional information or context that might be useful for the team."
description: "Provide any extra notes or context for the user story."
validations:
required: false

View File

@@ -585,7 +585,7 @@ def add_template_filters(application):
format_mobile_network, format_mobile_network,
format_yes_no, format_yes_no,
square_metres_to_square_miles, square_metres_to_square_miles,
convert_markdown_template convert_markdown_template,
]: ]:
application.add_template_filter(fn) application.add_template_filter(fn)

View File

@@ -26,18 +26,16 @@ from app.utils.time import parse_naive_dt
def apply_html_class(tags, html_file): def apply_html_class(tags, html_file):
new_html = html_file new_html = html_file
for tag in tags: for tag in tags:
element = tag[0] element = tag[0]
class_name = tag[1] class_name = tag[1]
soup = BeautifulSoup(new_html, 'html.parser') soup = BeautifulSoup(new_html, "html.parser")
for xtag in soup.find_all(element): for xtag in soup.find_all(element):
xtag['class'] = class_name xtag["class"] = class_name
new_html = str(soup) new_html = str(soup)
@@ -45,12 +43,11 @@ def apply_html_class(tags, html_file):
def convert_markdown_template(mdf, test=False): def convert_markdown_template(mdf, test=False):
content_text = "" content_text = ""
if not test: if not test:
APP_ROOT = get_root_path('notifications-admin') APP_ROOT = get_root_path("notifications-admin")
file = 'app/content/' + mdf + '.md' file = "app/content/" + mdf + ".md"
md_file = os.path.join(APP_ROOT, file) md_file = os.path.join(APP_ROOT, file)
with open(md_file) as f: with open(md_file) as f:
content_text = f.read() content_text = f.read()

View File

@@ -138,16 +138,20 @@ def get_started_old():
@main.route("/using-notify/get-started") @main.route("/using-notify/get-started")
@user_is_logged_in @user_is_logged_in
def get_started(): def get_started():
markdown = convert_markdown_template('get-started') markdown = convert_markdown_template("get-started")
html_style = apply_html_class([['ol', 'usa-process-list'], html_style = apply_html_class(
['li', 'usa-process-list__item padding-bottom-4 margin-top-2'], [
['h2', 'usa-process-list__heading line-height-sans-3']], ["ol", "usa-process-list"],
markdown) ["li", "usa-process-list__item padding-bottom-4 margin-top-2"],
["h2", "usa-process-list__heading line-height-sans-3"],
],
markdown,
)
return render_template( return render_template(
"views/get-started.html", "views/get-started.html",
navigation_links=using_notify_nav(), navigation_links=using_notify_nav(),
content=html_style content=html_style,
) )

View File

@@ -13,7 +13,7 @@
{% if link %} {% if link %}
</a> </a>
{% endif %} {% endif %}
<span class="big-number-status{% if (global_stats.email.failure_rate|float > 3) is sameas true %} big-number-status--failing{% endif %}"> <span class="big-number-status{% if (global_stats.email.failure_rate|float > 0) is sameas true %} big-number-status--failing{% endif %}">
{% if global_stats.email.failed %} {% if global_stats.email.failed %}
{% if failure_link %} {% if failure_link %}
<a class="usa-link" href="{{ failure_link }}"> <a class="usa-link" href="{{ failure_link }}">
@@ -44,7 +44,7 @@
{% if link %} {% if link %}
</a> </a>
{% endif %} {% endif %}
<span class="big-number-status{% if (global_stats.sms.failure_rate|float > 3) is sameas true %} big-number-status--failing{% endif %}"> <span class="big-number-status{% if (global_stats.sms.failure_rate|float > 0) is sameas true %} big-number-status--failing{% endif %}">
{% if global_stats.sms.failed %} {% if global_stats.sms.failed %}
{% if failure_link %} {% if failure_link %}
<a class="usa-link" href="{{ failure_link }}"> <a class="usa-link" href="{{ failure_link }}">

Binary file not shown.

40
poetry.lock generated
View File

@@ -928,20 +928,20 @@ smmap = ">=3.0.1,<6"
[[package]] [[package]]
name = "gitpython" name = "gitpython"
version = "3.1.40" version = "3.1.41"
description = "GitPython is a Python library used to interact with Git repositories" description = "GitPython is a Python library used to interact with Git repositories"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "GitPython-3.1.40-py3-none-any.whl", hash = "sha256:cf14627d5a8049ffbf49915732e5eddbe8134c3bdb9d476e6182b676fc573f8a"}, {file = "GitPython-3.1.41-py3-none-any.whl", hash = "sha256:c36b6634d069b3f719610175020a9aed919421c87552185b085e04fbbdb10b7c"},
{file = "GitPython-3.1.40.tar.gz", hash = "sha256:22b126e9ffb671fdd0c129796343a02bf67bf2994b35449ffc9321aa755e18a4"}, {file = "GitPython-3.1.41.tar.gz", hash = "sha256:ed66e624884f76df22c8e16066d567aaa5a37d5b5fa19db2c6df6f7156db9048"},
] ]
[package.dependencies] [package.dependencies]
gitdb = ">=4.0.1,<5" gitdb = ">=4.0.1,<5"
[package.extras] [package.extras]
test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", "pytest", "pytest-cov", "pytest-instafail", "pytest-subtests", "pytest-sugar"] test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", "pytest (>=7.3.1)", "pytest-cov", "pytest-instafail", "pytest-mock", "pytest-sugar", "sumtypes"]
[[package]] [[package]]
name = "govuk-bank-holidays" name = "govuk-bank-holidays"
@@ -1187,13 +1187,13 @@ files = [
[[package]] [[package]]
name = "jinja2" name = "jinja2"
version = "3.1.2" version = "3.1.3"
description = "A very fast and expressive template engine." description = "A very fast and expressive template engine."
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, {file = "Jinja2-3.1.3-py3-none-any.whl", hash = "sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa"},
{file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, {file = "Jinja2-3.1.3.tar.gz", hash = "sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90"},
] ]
[package.dependencies] [package.dependencies]
@@ -1389,13 +1389,13 @@ restructuredtext = ["rst2ansi"]
[[package]] [[package]]
name = "markdown" name = "markdown"
version = "3.5.1" version = "3.5.2"
description = "Python implementation of John Gruber's Markdown." description = "Python implementation of John Gruber's Markdown."
optional = false optional = false
python-versions = ">=3.8" python-versions = ">=3.8"
files = [ files = [
{file = "Markdown-3.5.1-py3-none-any.whl", hash = "sha256:5874b47d4ee3f0b14d764324d2c94c03ea66bee56f2d929da9f2508d65e722dc"}, {file = "Markdown-3.5.2-py3-none-any.whl", hash = "sha256:d43323865d89fc0cb9b20c75fc8ad313af307cc087e84b657d9eec768eddeadd"},
{file = "Markdown-3.5.1.tar.gz", hash = "sha256:b65d7beb248dc22f2e8a31fb706d93798093c308dc1aba295aedeb9d41a813bd"}, {file = "Markdown-3.5.2.tar.gz", hash = "sha256:e1ac7b3dc550ee80e602e71c1d168002f062e49f1b11e26a36264dafd4df2ef8"},
] ]
[package.dependencies] [package.dependencies]
@@ -1728,7 +1728,7 @@ requests = ">=2.0.0"
[[package]] [[package]]
name = "notifications-utils" name = "notifications-utils"
version = "0.2.4" version = "0.2.6"
description = "" description = ""
optional = false optional = false
python-versions = ">=3.9,<3.12" python-versions = ">=3.9,<3.12"
@@ -1753,7 +1753,7 @@ geojson = "^3.0.1"
govuk-bank-holidays = "^0.13" govuk-bank-holidays = "^0.13"
idna = "^3.4" idna = "^3.4"
itsdangerous = "^2.1.2" itsdangerous = "^2.1.2"
jinja2 = "^3.1.2" jinja2 = "^3.1.3"
jmespath = "^1.0.1" jmespath = "^1.0.1"
markupsafe = "^2.1.2" markupsafe = "^2.1.2"
mistune = "==0.8.4" mistune = "==0.8.4"
@@ -1780,7 +1780,7 @@ werkzeug = "^3.0.1"
type = "git" type = "git"
url = "https://github.com/GSA/notifications-utils.git" url = "https://github.com/GSA/notifications-utils.git"
reference = "HEAD" reference = "HEAD"
resolved_reference = "bd604dc32ea80b5d8a1157b09653e4bd4a755a6e" resolved_reference = "f183d120a8b86e655405694adde1f0d95e4e5a51"
[[package]] [[package]]
name = "numpy" name = "numpy"
@@ -1939,13 +1939,13 @@ pip = "*"
[[package]] [[package]]
name = "pip-audit" name = "pip-audit"
version = "2.6.3" version = "2.7.0"
description = "A tool for scanning Python environments for known vulnerabilities" description = "A tool for scanning Python environments for known vulnerabilities"
optional = false optional = false
python-versions = ">=3.8" python-versions = ">=3.8"
files = [ files = [
{file = "pip_audit-2.6.3-py3-none-any.whl", hash = "sha256:216983210db4a15393f9e80e4d24a805f5767e4c8e0c31fc70c336acc629613b"}, {file = "pip_audit-2.7.0-py3-none-any.whl", hash = "sha256:83e039740653eb9ef1a78b1540ed441600cd88a560588ba2c0a169180685a522"},
{file = "pip_audit-2.6.3.tar.gz", hash = "sha256:bd796066f69684b2f4fc2c2b6d222589e23190db0bbde069cea5c2b0be2cc57d"}, {file = "pip_audit-2.7.0.tar.gz", hash = "sha256:67740c5b1d5d967a258c3dfefc46f9713a2819c48062505ddf4b29de101c2b75"},
] ]
[package.dependencies] [package.dependencies]
@@ -3055,13 +3055,13 @@ watchdog = ["watchdog (>=2.3)"]
[[package]] [[package]]
name = "wtforms" name = "wtforms"
version = "3.1.1" version = "3.1.2"
description = "Form validation and rendering for Python web development." description = "Form validation and rendering for Python web development."
optional = false optional = false
python-versions = ">=3.8" python-versions = ">=3.8"
files = [ files = [
{file = "wtforms-3.1.1-py3-none-any.whl", hash = "sha256:ae7c54b29806c70f7bce8eb9f24afceb10ca5c32af3d9f04f74d2f66ccc5c7e0"}, {file = "wtforms-3.1.2-py3-none-any.whl", hash = "sha256:bf831c042829c8cdbad74c27575098d541d039b1faa74c771545ecac916f2c07"},
{file = "wtforms-3.1.1.tar.gz", hash = "sha256:5e51df8af9a60f6beead75efa10975e97768825a82146a65c7cbf5b915990620"}, {file = "wtforms-3.1.2.tar.gz", hash = "sha256:f8d76180d7239c94c6322f7990ae1216dae3659b7aa1cee94b6318bdffb474b9"},
] ]
[package.dependencies] [package.dependencies]
@@ -3126,4 +3126,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = ">=3.9,<3.12" python-versions = ">=3.9,<3.12"
content-hash = "b4223b62fe62c0dca55cafab817f7527081865b6f1e1c0a8c306c3eb0332b1e9" content-hash = "6f9697c8f58f1d17b4bc28f0ed908c4c1a327a2f4eeafbdf7374692408e9d682"

View File

@@ -37,7 +37,7 @@ pytz = "==2023.3.post1"
rtreelib = "==0.2.0" rtreelib = "==0.2.0"
werkzeug = "^3.0.1" werkzeug = "^3.0.1"
wtforms = "~=3.1" wtforms = "~=3.1"
markdown = "^3.5.1" markdown = "^3.5.2"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]

View File

@@ -174,16 +174,23 @@ def test_format_delta():
def test_jinja_format(fake_jinja_template): def test_jinja_format(fake_jinja_template):
app = Flask("app") app = Flask("app")
with app.app_context(): with app.app_context():
assert convert_markdown_template(fake_jinja_template, test=True) == "<p>True</p>" assert (
convert_markdown_template(fake_jinja_template, test=True) == "<p>True</p>"
)
@pytest.mark.usefixtures("fake_markdown_file") @pytest.mark.usefixtures("fake_markdown_file")
def test_markdown_format(fake_markdown_file): def test_markdown_format(fake_markdown_file):
app = Flask("app") app = Flask("app")
with app.app_context(): with app.app_context():
assert convert_markdown_template(fake_markdown_file, test=True) == "<h1>Test</h1>" assert (
convert_markdown_template(fake_markdown_file, test=True) == "<h1>Test</h1>"
)
@pytest.mark.usefixtures("fake_soup_template") @pytest.mark.usefixtures("fake_soup_template")
def test_soup_format(fake_soup_template): def test_soup_format(fake_soup_template):
assert apply_html_class([['h1', 'testClass']], fake_soup_template) == '<h1 class="testClass">Test</h1>' assert (
apply_html_class([["h1", "testClass"]], fake_soup_template)
== '<h1 class="testClass">Test</h1>'
)