Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TawneeOwl committed Mar 11, 2025
1 parent c9110df commit 6aa4607
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 72 deletions.
2 changes: 2 additions & 0 deletions app/categories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
9 changes: 9 additions & 0 deletions app/categories/more_problems/__init__.py
Original file line number Diff line number Diff line change
@@ -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
81 changes: 81 additions & 0 deletions app/categories/more_problems/constants.py
Original file line number Diff line number Diff line change
@@ -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",
},
]
34 changes: 34 additions & 0 deletions app/categories/more_problems/urls.py
Original file line number Diff line number Diff line change
@@ -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",
),
)
6 changes: 0 additions & 6 deletions app/categories/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
)
2 changes: 1 addition & 1 deletion app/templates/categories/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="govuk-heading-xl govuk-!-margin-bottom-6">{{ title }}</h1>

<hr class="govuk-section-break--l govuk-!-margin-top-9">
<h2 class="govuk-heading-m arrow-box">
<a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('categories.more_problems') }}">{{ _('More problems covered by legal aid') }}</a>
<a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('categories.more_problems.landing') }}">{{ _('More problems covered by legal aid') }}</a>
</h2>
<hr class="govuk-section-break--l govuk-!-margin-bottom-9">

Expand Down
61 changes: 6 additions & 55 deletions app/templates/categories/more-problems.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,12 @@
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-8">{{ title }}</h1>

{{ 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")) }}
<div class="govuk-!-margin-top-8">
{% 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 %}
</div>

<div class="govuk-!-margin-top-9 govuk-!-margin-bottom-9">
{{ cannot_find_your_problem(None, url_for("categories.results.cannot_find_your_problem"))}}
Expand Down
10 changes: 0 additions & 10 deletions tests/functional_tests/categories/test_clinical_negilgence.py

This file was deleted.

74 changes: 74 additions & 0 deletions tests/functional_tests/categories/test_more_problems.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 6aa4607

Please sign in to comment.