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

LGA 3465: Re-create refer page #117

Merged
merged 18 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/categories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
bp.register_blueprint(x_cat_bp)

from app.categories import urls # noqa: E402,F401
from app.categories import filters # noqa: E402,F401
70 changes: 44 additions & 26 deletions app/categories/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,68 @@ def __str__(self):


FAMILY = Category(
_("Children, families and relationships"), "FAMILY", "Family", "family"
display_text=_("Children, families and relationships"),
code="FAMILY",
article_category_name="Family",
chs_code="family",
)
HOUSING = Category(
_("Housing, homelessness, losing your home"), "HOUSING", "Housing", "housing"
display_text=_("Housing, homelessness, losing your home"),
code="HOUSING",
article_category_name="Housing",
chs_code="housing",
)
COMMUNITY_CARE = Category(
_("Community care"), "COMMUNITY_CARE", "Community care", "commcare"
display_text=_("Community care"),
code="COMMUNITY_CARE",
article_category_name="Community care",
chs_code="commcare",
)
DOMESTIC_ABUSE = Category(
_("Domestic abuse"), "DOMESTIC_ABUSE", "Domestic abuse", "family"
display_text=_("Domestic abuse"),
code="DOMESTIC_ABUSE",
article_category_name="Domestic Abuse",
chs_code="family",
)
BENEFITS = Category(
_("Appeal a decision about your benefits"),
"BENEFITS",
"Welfare benefits",
"benefits",
display_text=_("Welfare benefits"),
code="BENEFITS",
article_category_name="Welfare benefits",
chs_code="benefits",
)
DISCRIMINATION = Category(
_("Discrimination"), "DISCRIMINATION", "Discrimination", "discrimination"
display_text=_("Discrimination"),
code="DISCRIMINATION",
article_category_name="Discrimination",
chs_code="discrimination",
)
MENTAL_CAPACITY = Category(
_("Mental capacity, mental health"),
"MENTAL_CAPACITY",
"Mental health",
"mentalhealth",
display_text=_("Mental capacity, mental health"),
code="MENTAL_CAPACITY",
article_category_name="Mental health",
chs_code="mentalhealth",
)
ASYLUM_AND_IMMIGRATION = Category(
_("Asylum and immigration"), "ASYLUM_AND_IMMIGRATION", None, "immigration"
display_text=_("Asylum and immigration"),
code="ASYLUM_AND_IMMIGRATION",
article_category_name=None,
chs_code="immigration",
)
SOCIAL_CARE = Category(
_("Care needs for disability and old age (social care)"),
"SOCIAL_CARE",
None,
"commcare",
display_text=_("Care needs for disability and old age (social care)"),
code="SOCIAL_CARE",
article_category_name=None,
chs_code="commcare",
)
PUBLIC_LAW = Category(
_("Legal action against police and public organisations"),
"PUBLIC_LAW",
"Public",
"publiclaw",
display_text=_("Legal action against police and public organisations"),
code="PUBLIC_LAW",
article_category_name="Public",
chs_code="publiclaw",
)
EDUCATION = Category(
_("Special educational needs and disability (SEND)"),
"EDUCATION",
"Education",
"education",
display_text=_("Special educational needs and disability (SEND)"),
code="EDUCATION",
article_category_name="Education",
chs_code="education",
)
11 changes: 11 additions & 0 deletions app/categories/filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from flask_babel import lazy_gettext as _, LazyString
from app.categories.constants import EDUCATION
from app.categories import bp


@bp.app_template_filter("lowercase_category_name")
def lowercase_category_name(category_name: LazyString) -> LazyString:
"""Gets the lowercase variant of the translatable category name"""
if category_name == EDUCATION.display_text:
return _("special educational needs and disability (SEND)")
return category_name.lower()
3 changes: 1 addition & 2 deletions app/categories/results/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from app.categories.results import bp
from app.categories.views import CategoryPage
from app.categories.results.views import HlpasInScopePage, ResultPage

bp.add_url_rule(
Expand All @@ -14,5 +13,5 @@
)
bp.add_url_rule(
"/refer",
view_func=CategoryPage.as_view("refer", template="categories/refer.html"),
view_func=ResultPage.as_view("refer", template="categories/refer.html"),
)
27 changes: 17 additions & 10 deletions app/categories/results/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from app.categories.constants import Category
from app.categories.views import CategoryPage
from flask import session, redirect, url_for, render_template
from app.find_a_legal_adviser.laalaa import get_category_code as get_fala_category_code
Expand All @@ -12,18 +13,24 @@ def dispatch_request(self):

class ResultPage(CategoryPage):
@staticmethod
def get_context():
category = session.category
alt_help_category = category.article_category_name
organisations = cla_backend.get_help_organisations(alt_help_category)
def get_context(category: Category = None):
article_category_name = (
category.article_category_name
if isinstance(category, Category)
else "other"
)
organisations = (
cla_backend.get_help_organisations(article_category_name)
if article_category_name
else []
)
return {
"category_name": alt_help_category,
"category_name": category.display_text
if isinstance(category, Category)
else None,
"organisations": organisations,
"fala_category_code": get_fala_category_code(
category.article_category_name
),
"fala_category_code": get_fala_category_code(article_category_name),
}

def dispatch_request(self):
session["traversal_protection"] = True
return render_template(self.template, **self.get_context())
return render_template(self.template, **self.get_context(session.category))
2 changes: 2 additions & 0 deletions app/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def category(self) -> Category | None:
category_dict = self.get("category")
if category_dict is None:
return None
if isinstance(category_dict, Category):
return category_dict
return Category(**category_dict)

@property
Expand Down
2 changes: 1 addition & 1 deletion app/templates/categories/in-scope.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h2 class="govuk-heading-m">{% trans %}Before you start{% endtrans %}</h2>
{% if organisations %}
<h2 class="govuk-heading-m">{{ _('Other sources of help') }}</h2>
<p class="govuk-body">
{% trans category_name=_(category_name).lower() %}You can also get advice from alternative help organisations for issues related to {{ category_name }}. You don’t have to qualify for legal aid.{% endtrans %}
{% trans category_name=_(category_name) | lowercase_category_name %}You can also get advice from alternative help organisations for issues related to {{ category_name }}. You don’t have to qualify for legal aid.{% endtrans %}
</p>
{{ helpOrganisationsList(organisations) }}
{% endif %}
Expand Down
55 changes: 52 additions & 3 deletions app/templates/categories/refer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{% extends "base.html" %}
{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink-%}
{%- from 'categories/components/list-item.html' import list_item, list_item_small -%}
{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%}
{%- from 'govuk_frontend_jinja/components/button/macro.html' import govukButton -%}
{%- from 'categories/components/help-organisations.html' import helpOrganisationsList %}

{% set fala_url = url_for("find-a-legal-adviser.search", category=fala_category_code.lower() if fala_category_code else None) %}

{% set title = _('Legal aid doesn’t cover all types of problem') %}
{% block pageTitle %}{{ title }} - {{ super() }}{% endblock %}

{% block beforeContent%}
{{ super() }}
Expand All @@ -13,7 +19,50 @@
{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">Referral page</h1>
<h1 class="govuk-heading-xl">{{ title }}</h1>
{% if category != 'other' %}
<p class="govuk-body">{% trans %}You can still ask a solicitor for help – you will have to pay for their advice.{% endtrans %}</p>
{% else %}
<p class="govuk-body">You can <a class="govuk-link">ask a legal adviser</a> if an application might succeed in your case and how to apply.</p>
<p class="govuk-body">{{ _('You can still ask a solicitor for help - you will have to pay for their advice.') }}</p>
{% endif %}

{{ govukButton({
"text": _("Find a solicitor"),
"href": "https://www.gov.uk/find-a-legal-adviser"
}) }}

<p class="govuk-body">
<a class="govuk-link" href="https://www.gov.uk/done/check-if-civil-legal-advice-can-help-you" aria-labelledby="aria-satisfaction-survey">
{% trans %}What did you think of this service?{% endtrans %}</a> {% trans %}(takes 30 seconds){% endtrans %}
</p>

{% if category != 'other' and organisations %}
<p class="govuk-body">
{% trans %}You may still get help and advice from the organisations listed below. You don’t have to qualify for legal aid.{% endtrans %}
</p>

{# We use lowercase_category_name rather than lower, to not convert acronyms to lowercase #}
<h2 class="govuk-heading-l">{% trans category_name=_(category_name) | lowercase_category_name %}Help organisations for problems about {{ category_name }}{% endtrans %}</h2>
{{ helpOrganisationsList(organisations, truncate=5) }}
{% endif %}
</div>
<div class="govuk-grid-column-one-third">
<aside class="sidebar">
<h2 class="govuk-heading-m">{% trans %}Exceptional cases{% endtrans %}</h2>
{% if category == 'education' %}
<p class="govuk-body">{% trans %}In exceptional cases or if your case is going to a judicial review, legal aid may still be available.{% endtrans %}</p>
{% else %}
<p class="govuk-body">{% trans %}In exceptional cases, legal aid may still be available.{% endtrans %}</p>
{% endif %}

{% set fala_link %}<a class='govuk-link' href={{ fala_url }}>{% trans %}ask a legal adviser{% endtrans %}</a> {% endset %}

<p class="govuk-body">{% trans fala_link=fala_link %}You can {{fala_link}} if an application might succeed in your case and how to apply.{% endtrans %}</p>

{% set ecf_link %}<a href='https://www.gov.uk/legal-aid-apply-for-exceptional-case-funding' rel='external' class='govuk-link'>{% trans %}apply directly{% endtrans %}</a>{% endset %}
<p class="govuk-body">{% trans ecf_link=ecf_link %}You can also {{ ecf_link }} to the Legal Aid Agency.{% endtrans %}</p>
</aside>
</div>
</div>
{% endblock %}
Binary file modified app/translations/cy/LC_MESSAGES/messages.mo
Binary file not shown.
82 changes: 80 additions & 2 deletions app/translations/cy/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ msgstr "Gofal cymunedol"
msgid "Domestic abuse"
msgstr "Cam-drin domestig"

msgid "Appeal a decision about your benefits"
msgstr ""
msgid "Welfare benefits"
msgstr "Budd-daliadau lles"

msgid "Discrimination"
msgstr "Gwahaniaethu"
Expand All @@ -31,6 +31,9 @@ msgstr ""
msgid "Special educational needs and disability (SEND)"
msgstr ""

msgid "special educational needs and disability (SEND)"
msgstr ""

msgid "Validation failed message"
msgstr ""

Expand Down Expand Up @@ -1191,6 +1194,75 @@ msgstr ""
msgid "Help if you’re a victim of human trafficking or modern slavery."
msgstr ""

msgid "Legal aid doesn’t cover all types of problem"
msgstr "Nid yw cymorth cyfreithiol yn gallu delio â phob math o broblem"

msgid ""
"You can still ask a solicitor for help – you will have to pay for their "
"advice."
msgstr ""
"Gallwch dal ofyn i gyfreithiwr eich helpu - bydd rhaid ichi dalu am eu "
"cyngor."

msgid ""
"You can still ask a solicitor for help - you will have to pay for their "
"advice."
msgstr ""
"Gallwch dal ofyn i gyfreithiwr eich helpu - bydd rhaid ichi dalu am eu "
"cyngor."

msgid "Find a solicitor"
msgstr "Dod o hyd i gyfreithiwr"

msgid "What did you think of this service?"
msgstr "Beth oeddech chi’n feddwl o’r gwasanaeth hwn?"

msgid "(takes 30 seconds)"
msgstr "(mae’n cymryd 30 eiliad)"

msgid ""
"You may still get help and advice from the organisations listed below. "
"You don’t have to qualify for legal aid."
msgstr ""
"Efallai y byddwch chi’n dal yn gallu cael help a chyngor gan y "
"sefydliadau sydd wedi’u rhestru isod. Nid oes rhaid i chi fod yn gymwys i"
" gael cymorth cyfreithiol."

#, python-format
msgid "Help organisations for problems about %(category_name)s"
msgstr "Sefydliadau cymorth ar gyfer problemau ynghylch %(category_name)s"

msgid "Exceptional cases"
msgstr "Achosion eithriadol"

msgid ""
"In exceptional cases or if your case is going to a judicial review, legal"
" aid may still be available."
msgstr ""
"Mewn achosion arbennig, nes os bydd eich achos yn destun adolygiad "
"barnwrol, gall cyngor cyfreithiol dal fod ar gael."

msgid "In exceptional cases, legal aid may still be available."
msgstr "Gall cymorth cyfreithiol dal fod ar gael mewn achosion eithriadol."

msgid "ask a legal adviser"
msgstr "ofyn am gyngor gan gynghorydd"

#, python-format
msgid ""
"You can %(fala_link)s if an application might succeed in your case and "
"how to apply."
msgstr ""
"Gallwch %(fala_link)s cyfreithiol ynghylch a fydd cais am gymorth "
"cyfreithiol yn debygol o lwyddo yn eich achos chi a sut i wneud cais."

msgid "apply directly"
msgstr "gyflwyno cais yn uniongyrchol"

#, python-format
msgid "You can also %(ecf_link)s to the Legal Aid Agency."
msgstr "Gallwch hefyd %(ecf_link)s i’r Asiantaeth Cymorth Cyfreithiol."

msgid "Applying for asylum"
msgstr ""

Expand Down Expand Up @@ -1227,6 +1299,9 @@ msgstr ""
msgid "Help if you’re a victim of trafficking or modern slavery."
msgstr ""

msgid "Appeal a decision about your benefits"
msgstr ""

msgid "Legal aid only covers appeals to the:"
msgstr ""

Expand Down Expand Up @@ -1848,3 +1923,6 @@ msgstr "Carafannau a cherbydau eraill nad ydych chi’n eu defnyddio bob dydd"
msgid "Musical instruments, unless you’re a professional musician"
msgstr "Offerynnau cerddorol, oni bai’ch bod yn gerddor proffesiynol"

#~ msgid "Benefits"
#~ msgstr ""

Loading
Loading