From c57e4b935599a866470b8cfa764748cb4c38193a Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Thu, 11 Jan 2024 12:43:49 -0500 Subject: [PATCH 1/3] Adding a template to create a User Story issue --- .github/ISSUE_TEMPLATE/issue_template.yaml | 78 ++++++++++++++++++++++ app/__init__.py | 2 +- app/formatters.py | 11 ++- app/main/views/index.py | 16 +++-- tests/app/main/test_formatters.py | 13 +++- 5 files changed, 103 insertions(+), 17 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/issue_template.yaml diff --git a/.github/ISSUE_TEMPLATE/issue_template.yaml b/.github/ISSUE_TEMPLATE/issue_template.yaml new file mode 100644 index 0000000000..b4e324e6be --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue_template.yaml @@ -0,0 +1,78 @@ +name: "User Story Template" + +about: "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 diff --git a/app/__init__.py b/app/__init__.py index 322a122104..9ec056c2be 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -585,7 +585,7 @@ def add_template_filters(application): format_mobile_network, format_yes_no, square_metres_to_square_miles, - convert_markdown_template + convert_markdown_template, ]: application.add_template_filter(fn) diff --git a/app/formatters.py b/app/formatters.py index ec3075e6c7..86c187f55e 100644 --- a/app/formatters.py +++ b/app/formatters.py @@ -26,18 +26,16 @@ def apply_html_class(tags, html_file): - new_html = html_file for tag in tags: - element = tag[0] class_name = tag[1] - soup = BeautifulSoup(new_html, 'html.parser') + soup = BeautifulSoup(new_html, "html.parser") for xtag in soup.find_all(element): - xtag['class'] = class_name + xtag["class"] = class_name new_html = str(soup) @@ -45,12 +43,11 @@ def apply_html_class(tags, html_file): def convert_markdown_template(mdf, test=False): - content_text = "" if not test: - APP_ROOT = get_root_path('notifications-admin') - file = 'app/content/' + mdf + '.md' + APP_ROOT = get_root_path("notifications-admin") + file = "app/content/" + mdf + ".md" md_file = os.path.join(APP_ROOT, file) with open(md_file) as f: content_text = f.read() diff --git a/app/main/views/index.py b/app/main/views/index.py index ef5c1a5daa..f4e3a67dbf 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -138,16 +138,20 @@ def get_started_old(): @main.route("/using-notify/get-started") @user_is_logged_in def get_started(): - markdown = convert_markdown_template('get-started') - html_style = apply_html_class([['ol', 'usa-process-list'], - ['li', 'usa-process-list__item padding-bottom-4 margin-top-2'], - ['h2', 'usa-process-list__heading line-height-sans-3']], - markdown) + markdown = convert_markdown_template("get-started") + html_style = apply_html_class( + [ + ["ol", "usa-process-list"], + ["li", "usa-process-list__item padding-bottom-4 margin-top-2"], + ["h2", "usa-process-list__heading line-height-sans-3"], + ], + markdown, + ) return render_template( "views/get-started.html", navigation_links=using_notify_nav(), - content=html_style + content=html_style, ) diff --git a/tests/app/main/test_formatters.py b/tests/app/main/test_formatters.py index 81e78ed0c2..b9fd7f975b 100644 --- a/tests/app/main/test_formatters.py +++ b/tests/app/main/test_formatters.py @@ -174,16 +174,23 @@ def test_format_delta(): def test_jinja_format(fake_jinja_template): app = Flask("app") with app.app_context(): - assert convert_markdown_template(fake_jinja_template, test=True) == "

True

" + assert ( + convert_markdown_template(fake_jinja_template, test=True) == "

True

" + ) @pytest.mark.usefixtures("fake_markdown_file") def test_markdown_format(fake_markdown_file): app = Flask("app") with app.app_context(): - assert convert_markdown_template(fake_markdown_file, test=True) == "

Test

" + assert ( + convert_markdown_template(fake_markdown_file, test=True) == "

Test

" + ) @pytest.mark.usefixtures("fake_soup_template") def test_soup_format(fake_soup_template): - assert apply_html_class([['h1', 'testClass']], fake_soup_template) == '

Test

' + assert ( + apply_html_class([["h1", "testClass"]], fake_soup_template) + == '

Test

' + ) From a2ca10a6c51d5c2fc7361676154fa8c03c759c34 Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Thu, 11 Jan 2024 12:52:35 -0500 Subject: [PATCH 2/3] About wasn't a permitted key --- .github/ISSUE_TEMPLATE/issue_template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/issue_template.yaml b/.github/ISSUE_TEMPLATE/issue_template.yaml index b4e324e6be..bbd6bab28e 100644 --- a/.github/ISSUE_TEMPLATE/issue_template.yaml +++ b/.github/ISSUE_TEMPLATE/issue_template.yaml @@ -1,6 +1,6 @@ name: "User Story Template" -about: "Use this template for creating user stories." +description: "Use this template for creating user stories." title: "User Story: [Brief description of the user story]" From dd02ae587b007ddef192e4ec6a5f9de841a51d78 Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Thu, 11 Jan 2024 13:51:06 -0500 Subject: [PATCH 3/3] Adding a config --- .github/ISSUE_TEMPLATE/config.yml | 1 + .../{issue_template.yaml => issue_template.yml} | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml rename .github/ISSUE_TEMPLATE/{issue_template.yaml => issue_template.yml} (97%) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..0086358db1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/issue_template.yaml b/.github/ISSUE_TEMPLATE/issue_template.yml similarity index 97% rename from .github/ISSUE_TEMPLATE/issue_template.yaml rename to .github/ISSUE_TEMPLATE/issue_template.yml index bbd6bab28e..576af00957 100644 --- a/.github/ISSUE_TEMPLATE/issue_template.yaml +++ b/.github/ISSUE_TEMPLATE/issue_template.yml @@ -1,7 +1,5 @@ name: "User Story Template" - -description: "Use this template for creating user stories." - +description: "Use this template for creating user stories" title: "User Story: [Brief description of the user story]" labels: