diff --git a/app/categories/__init__.py b/app/categories/__init__.py index 412b81c9b..6b408af8f 100644 --- a/app/categories/__init__.py +++ b/app/categories/__init__.py @@ -11,6 +11,7 @@ from .benefits import bp as benefits_bp from .results import bp as results_bp from .x_cat import bp as x_cat_bp +from .more_problems import bp as more_problems_bp bp = Blueprint("categories", __name__) bp.register_blueprint(domestic_abuse_bp) @@ -25,6 +26,7 @@ bp.register_blueprint(public_bp) bp.register_blueprint(benefits_bp) bp.register_blueprint(x_cat_bp) +bp.register_blueprint(more_problems_bp) from app.categories import urls # noqa: E402,F401 from app.categories import filters # noqa: E402,F401 diff --git a/app/categories/more_problems/__init__.py b/app/categories/more_problems/__init__.py new file mode 100644 index 000000000..b6c0b6c59 --- /dev/null +++ b/app/categories/more_problems/__init__.py @@ -0,0 +1,9 @@ +from flask import Blueprint + +bp = Blueprint( + "more_problems", + __name__, + template_folder="./templates", +) + +from app.categories.more_problems import urls # noqa: E402,F401 diff --git a/app/categories/more_problems/constants.py b/app/categories/more_problems/constants.py new file mode 100644 index 000000000..9e0e3665e --- /dev/null +++ b/app/categories/more_problems/constants.py @@ -0,0 +1,81 @@ +MORE_PROBLEMS = [ + { + "heading": "Adopting a child from outside the UK", + "description": "Adoption processes in the courts.", + "next_page": "find-a-legal-adviser.search", + "category": "mat", + }, + { + "heading": "Appeal a decision that you cannot work with children or vulnerable adults", + "description": "Including if you’re on a ‘barred list’ or disqualified from teaching.", + "next_page": "find-a-legal-adviser.search", + }, + { + "heading": "Anti-social behaviour and gangs", + "description": "If you’re accused or taken to court for anti-social behaviour, including being in a gang.", + "next_page": "categories.x_cat.landlord-council", + }, + { + "heading": "Clinical negligence in babies", + "description": "Help if a baby has brain or nerve damage caused during pregnancy, childbirth or up to 8 weeks old.", + "next_page": "find-a-legal-adviser.search", + "category": "med", + }, + { + "heading": "Compensation for abuse, assault or neglect", + "description": "Includes child abuse, sexual assault, abuse of a vulnerable adult. Claims can be against a person or an organisation.", + "next_page": "find-a-legal-adviser.search", + "category": "aap", + }, + { + "heading": "Domestic abuse - if you have been accused", + "description": "Legal help if you’ve been accused of domestic abuse or forced marriage. Includes non-molestation orders and other court orders.", + "next_page": "categories.results.in_scope", + }, + { + "heading": "Environmental pollution", + "description": "Issues about air, water or land pollution that is harming you or the environment.", + "next_page": "find-a-legal-adviser.search", + "category": "pub", + }, + { + "heading": "Female genital mutilation (FGM)", + "description": "If you or someone else is at risk of FGM.", + "next_page": "categories.domestic_abuse.are_you_at_risk_of_harm", + }, + { + "heading": "Forced marriage", + "description": "Help with forced marriage and Forced Marriage Protection Orders.", + "next_page": "categories.domestic_abuse.are_you_at_risk_of_harm", + }, + { + "heading": "Inquests for family members", + "description": "Advice to prepare for the inquest of a family member.", + "next_page": "find-a-legal-adviser.search", + }, + { + "heading": "Mental health detention", + "description": "Help if you’re held in hospital (‘sectioned’), mental health tribunals and community treatment orders.", + "next_page": "find-a-legal-adviser.search", + "category": "mhe", + }, + { + "heading": "Proceeds of Crime Act", + "description": "If you’re facing legal action to take your money or other assets.", + "next_page": "find-a-legal-adviser.search", + "category": "crm", + }, + { + "heading": "Terrorism", + "description": "If you’re accused of terrorism or financing terrorist groups.", + "next_page": "find-a-legal-adviser.search", + "category": "immas", + "secondary_category": "pub", + }, + { + "heading": "Trafficking, modern slavery", + "description": "Help if you’re a victim of human trafficking or modern slavery.", + "next_page": "find-a-legal-adviser.search", + "category": "immas", + }, +] diff --git a/app/categories/more_problems/urls.py b/app/categories/more_problems/urls.py new file mode 100644 index 000000000..2c5395bbb --- /dev/null +++ b/app/categories/more_problems/urls.py @@ -0,0 +1,34 @@ +from flask import render_template +from app.categories.more_problems import bp +from app.categories.views import CategoryPage +from app.categories.results.views import CannotFindYourProblemPage, NextStepsPage +from app.categories.more_problems.constants import MORE_PROBLEMS + + +class MoreProblemsPage(CategoryPage): + template = "categories/more-problems.html" + + def dispatch_request(self): + listing = MORE_PROBLEMS + return render_template(self.template, listing=listing) + + +bp.add_url_rule( + "/more-problems", + view_func=MoreProblemsPage.as_view( + "landing", template="categories/more-problems.html" + ), +) +bp.add_url_rule( + "/more-problems/cannot-find-your-problem", + view_func=CannotFindYourProblemPage.as_view( + "cannot_find_your_problem", + next_steps_page="categories.more_problems.next_steps", + ), +) +bp.add_url_rule( + "/more-problems/next-steps", + view_func=NextStepsPage.as_view( + "next_steps", + ), +) diff --git a/app/categories/urls.py b/app/categories/urls.py index ea375578e..e8f98e298 100644 --- a/app/categories/urls.py +++ b/app/categories/urls.py @@ -38,9 +38,3 @@ def dispatch_request(self): "/find-your-problem", view_func=IndexPage.as_view("index", template="categories/index.html"), ) -bp.add_url_rule( - "/more-problems", - view_func=CategoryPage.as_view( - "more_problems", template="categories/more-problems.html" - ), -) diff --git a/app/templates/categories/index.html b/app/templates/categories/index.html index 14627b44b..200ff16ca 100644 --- a/app/templates/categories/index.html +++ b/app/templates/categories/index.html @@ -22,7 +22,7 @@

{{ title }}


- {{ _('More problems covered by legal aid') }} + {{ _('More problems covered by legal aid') }}


diff --git a/app/templates/categories/more-problems.html b/app/templates/categories/more-problems.html index 9fd0f53eb..7c81a5bcc 100644 --- a/app/templates/categories/more-problems.html +++ b/app/templates/categories/more-problems.html @@ -16,61 +16,12 @@

{{ title }}

- {{ list_item_small(_("Adopting a child from outside the UK"), - _("Adoption processes in the courts."), - url_for("categories.index")) }} - - {{ list_item_small(_("Appeal a decision that you cannot work with children or vulnerable adults"), - _("Including if you’re on a ‘barred list’ or disqualified from teaching."), - url_for("categories.index")) }} - - {{ list_item_small(_("Anti-social behaviour and gangs"), - _("If you’re accused or taken to court for anti-social behaviour, including being in a gang."), - url_for("categories.x_cat.landlord-council")) }} - - {{ list_item_small(_("Clinical negligence in babies"), - _("Help if a baby has brain or nerve damage caused during pregnancy, childbirth or up to 8 weeks old."), - url_for("find-a-legal-adviser.search", category="med")) }} - - {{ list_item_small(_("Compensation for abuse, assault or neglect"), - _("Includes child abuse, sexual assault, abuse of a vulnerable adult. Claims can be against a person or an organisation."), - url_for("categories.index")) }} - - {{ list_item_small(_("Domestic abuse - if you have been accused"), - _("Legal help if you’ve been accused of domestic abuse or forced marriage. Includes non-molestation orders and other court orders."), - url_for("categories.index")) }} - - {{ list_item_small(_("Environmental pollution"), - _("Issues about air, water or land pollution that is harming you or the environment."), - url_for("categories.index")) }} - - {{ list_item_small(_("Female genital mutilation (FGM)"), - _("If you or someone else is at risk of FGM."), - url_for("categories.index")) }} - - {{ list_item_small(_("Forced marriage"), - _("Help with forced marriage and Forced Marriage Protection Orders."), - url_for("categories.index")) }} - - {{ list_item_small(_("Inquests for family members"), - _("Advice to prepare for the inquest of a family member."), - url_for("categories.index")) }} - - {{ list_item_small(_("Mental health detention"), - _("Help if you’re held in hospital (‘sectioned’), mental health tribunals and community treatment orders."), - url_for("categories.index"))}} - - {{ list_item_small(_("Proceeds of Crime Act"), - _("If you’re facing legal action to take your money or other assets."), - url_for("categories.index")) }} - - {{ list_item_small(_("Terrorism"), - _("If you’re accused of terrorism or financing terrorist groups."), - url_for("categories.index")) }} - - {{ list_item_small(_("Trafficking, modern slavery"), - _("Help if you’re a victim of human trafficking or modern slavery."), - url_for("categories.index")) }} +
+ {% for item in listing %} + {% set url = url_for(item.next_page, category=item.category if item.category else None, secondary_category=item.secondary_category if item.secondary_category else None) %} + {{ list_item_small(item.heading, item.description, url) }} + {% endfor %} +
{{ cannot_find_your_problem(None, url_for("categories.results.cannot_find_your_problem"))}} diff --git a/tests/functional_tests/categories/test_clinical_negilgence.py b/tests/functional_tests/categories/test_clinical_negilgence.py deleted file mode 100644 index 42512606b..000000000 --- a/tests/functional_tests/categories/test_clinical_negilgence.py +++ /dev/null @@ -1,10 +0,0 @@ -from playwright.sync_api import Page, expect -import pytest - - -@pytest.mark.usefixtures("live_server") -def test_clinical_negligence(page: Page): - page.get_by_role("link", name="More problems covered by").click() - page.get_by_role("link", name="Clinical negligence in babies").click() - expect(page.get_by_role("heading", name="Find a legal adviser")).to_be_visible() - expect(page.get_by_text("For clinical negligence")).to_be_visible() diff --git a/tests/functional_tests/categories/test_more_problems.py b/tests/functional_tests/categories/test_more_problems.py new file mode 100644 index 000000000..b461cb07e --- /dev/null +++ b/tests/functional_tests/categories/test_more_problems.py @@ -0,0 +1,74 @@ +from playwright.sync_api import Page, expect +import pytest + + +@pytest.mark.usefixtures("live_server") +@pytest.mark.parametrize( + "category_name, expected_heading", + [ + pytest.param( + "Adopting a child from outside the UK", + "Find a legal adviser", + ), + pytest.param( + "Appeal a decision that you cannot work with children or vulnerable adults", + "Find a legal adviser", + ), + pytest.param( + "Anti-social behaviour and gangs", + "Were you accused by a landlord or the council?", + ), + pytest.param( + "Clinical negligence in babies", + "Find a legal adviser", + ), + pytest.param( + "Compensation for abuse, assault or neglect", + "Find a legal adviser", + ), + pytest.param( + "Domestic abuse - if you have been accused", + "Legal aid is available for this type of problem", + ), + pytest.param( + "Environmental pollution", + "Find a legal adviser", + ), + pytest.param( + "Female genital mutilation (FGM)", + "Are you worried about someone's safety?", + ), + pytest.param( + "Forced marriage", + "Are you worried about someone's safety?", + ), + pytest.param( + "Inquests for family members", + "Find a legal adviser", + ), + pytest.param( + "Mental health detention", + "Find a legal adviser", + ), + pytest.param( + "Proceeds of Crime Act", + "Find a legal adviser", + ), + pytest.param( + "Terrorism", + "Find a legal adviser", + ), + pytest.param( + "Trafficking, modern slavery", + "Find a legal adviser", + ), + pytest.param( + "Next steps to get help", + "Sorry, you’re not likely to get legal aid", + ), + ], +) +def test_more_problems(page: Page, category_name: str, expected_heading: str): + page.get_by_role("link", name="More problems covered by legal aid").click() + page.get_by_role("link", name=category_name).click() + expect(page.get_by_role("heading", name=expected_heading)).to_be_visible()