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

LTD-5573-make-makedown-safe-remove #2219

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 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
2 changes: 1 addition & 1 deletion caseworker/cases/forms/attach_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def attach_documents_form(case_url):
def upload_document_form(queue_pk):
return Form(
UploadEnforcementXML.TITLE,
UploadEnforcementXML.DESCRIPTION,
"",
[
FileUpload(name="file"),
],
Expand Down
6 changes: 3 additions & 3 deletions caseworker/cases/forms/finalise_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def approve_licence_form(queue_pk, case_id, is_open_licence, editable_duration,
title=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.APPROVE_TITLE,
questions=[
DateInput(
description=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.DATE_DESCRIPTION,
description="For example, 27 3 2019",
title=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.DATE_TITLE,
prefix="",
),
Expand Down Expand Up @@ -48,9 +48,9 @@ def approve_licence_form(queue_pk, case_id, is_open_licence, editable_duration,

def deny_licence_form(queue_pk, case_id, is_open_licence, nlr):
if nlr:
description = lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.NLR_DESCRIPTION
description = "You'll be informing the exporter that no licence is required"
else:
description = lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.REFUSE_DESCRIPTION
description = "You'll be denying the case"

return Form(
title=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.FINALISE_TITLE,
Expand Down
2 changes: 1 addition & 1 deletion caseworker/cases/forms/generate_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def select_template_form(templates, back_url):
def select_addressee_form():
return Form(
title=GenerateDocumentsPage.AddresseeForm.TITLE,
description=GenerateDocumentsPage.AddresseeForm.DESCRIPTION,
description="",
questions=[Custom("components/addressee-table.html")],
default_button_name=letter_templates.LetterTemplatesPage.PickTemplate.BUTTON,
container="case",
Expand Down
2 changes: 1 addition & 1 deletion caseworker/cases/forms/move_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def move_case_form(request: HttpRequest, queue, case: dict):
return Form(
title=Manage.MoveCase.TITLE,
description=Manage.MoveCase.DESCRIPTION,
description="",
questions=[
Filter(),
Checkboxes("queues[]", get_queues(request, convert_to_options=True), filterable=True),
Expand Down
2 changes: 1 addition & 1 deletion caseworker/cases/forms/reissue_ogl_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def reissue_ogl_confirmation_form(case_id, queue_id):
return Form(
title=Manage.ReissueOGL.TITLE,
description=Manage.ReissueOGL.DESCRIPTION,
description="Doing so will allow the exporter to resume using this open general licence",
questions=[
RadioButtons(
name="confirm",
Expand Down
23 changes: 13 additions & 10 deletions caseworker/letter_templates/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from caseworker.letter_templates.services import get_letter_layouts
from lite_forms.helpers import conditional

EDIT_LETTER_TEMPLATE_HINT = """Call it something that:<br /> • is easy to find<br />
• explains when to use this template<br>For example, 'Refuse a licence' """


def _letter_layout_options(request):
options = []
Expand Down Expand Up @@ -49,7 +52,7 @@ def add_letter_template(request):
forms=[
Form(
title=strings.LetterTemplates.AddLetterTemplate.Name.TITLE,
description=strings.LetterTemplates.AddLetterTemplate.Name.HINT,
description=EDIT_LETTER_TEMPLATE_HINT,
questions=[TextInput(name="name")],
back_link=BackLink(
strings.LetterTemplates.AddLetterTemplate.Name.BACK_LINK,
Expand All @@ -75,7 +78,7 @@ def add_letter_template(request):
is_application_case_types_only,
Form(
title=strings.LetterTemplates.EditLetterTemplate.Decisions.TITLE,
description=strings.LetterTemplates.EditLetterTemplate.Decisions.DESCRIPTION,
description="Select the decisions that apply to your template",
questions=[
Checkboxes(
name="decisions[]",
Expand All @@ -90,7 +93,7 @@ def add_letter_template(request):
),
Form(
title=strings.LetterTemplates.AddLetterTemplate.VisibleToExporter.TITLE,
description=strings.LetterTemplates.AddLetterTemplate.VisibleToExporter.DESCRIPTION,
description="Should documents created with this template be visible to exporters?",
questions=[
RadioButtons(
name="visible_to_exporter",
Expand All @@ -108,7 +111,7 @@ def add_letter_template(request):
),
Form(
title=strings.LetterTemplates.AddLetterTemplate.IncludeSignature.TITLE,
description=strings.LetterTemplates.AddLetterTemplate.IncludeSignature.DESCRIPTION,
description="",
questions=[
RadioButtons(
name="include_digital_signature",
Expand Down Expand Up @@ -138,25 +141,25 @@ def edit_letter_template(request, letter_template, case_type_options, decision_o
title=strings.LetterTemplates.EditLetterTemplate.TITLE % letter_template["name"],
questions=[
TextInput(
title=strings.LetterTemplates.EditLetterTemplate.Name.TITLE,
description=strings.LetterTemplates.EditLetterTemplate.Name.HINT,
title="Give your template a name",
description=EDIT_LETTER_TEMPLATE_HINT,
name="name",
),
Checkboxes(
title=strings.LetterTemplates.EditLetterTemplate.CaseTypes.TITLE,
title="When should someone use this template?",
name="case_types[]",
options=case_type_options,
classes=["govuk-checkboxes--small"],
),
Checkboxes(
title=strings.LetterTemplates.EditLetterTemplate.Decisions.TITLE,
description=strings.LetterTemplates.EditLetterTemplate.Decisions.DESCRIPTION,
title="Decisions (optional)",
description="Select the decisions that apply to your template",
name="decisions[]",
options=decision_options,
classes=["govuk-checkboxes--small"],
),
RadioButtonsImage(
title=strings.LetterTemplates.EditLetterTemplate.Layout.TITLE,
title="Choose a layout",
name="layout",
options=_letter_layout_options(request),
),
Expand Down
8 changes: 3 additions & 5 deletions caseworker/organisations/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,18 @@ def register_organisation_forms(request):
[
Form(
title=RegisterAnOrganisation.CommercialOrIndividual.TITLE,
description=RegisterAnOrganisation.CommercialOrIndividual.DESCRIPTION,
description="",
questions=[
RadioButtons(
name="type",
options=[
Option(
key="commercial",
value=RegisterAnOrganisation.CommercialOrIndividual.COMMERCIAL_TITLE,
description=RegisterAnOrganisation.CommercialOrIndividual.COMMERCIAL_DESCRIPTION,
),
Option(
key="individual",
value=RegisterAnOrganisation.CommercialOrIndividual.INDIVIDUAL_TITLE,
description=RegisterAnOrganisation.CommercialOrIndividual.INDIVIDUAL_DESCRIPTION,
),
],
)
Expand All @@ -65,7 +63,7 @@ def register_organisation_forms(request):
),
Form(
title=RegisterAnOrganisation.WhereIsTheExporterBased.TITLE,
description=RegisterAnOrganisation.WhereIsTheExporterBased.DESCRIPTION,
description="",
questions=[
RadioButtons(
name="location",
Expand Down Expand Up @@ -185,7 +183,7 @@ def create_admin_user_form():
TextInput(title="Contact telephone number", name="user.phone_number", optional=True),
],
default_button_name="Submit",
helpers=[HelpSection("Help", RegisterAnOrganisation.DEFAULT_USER)],
helpers=[HelpSection("Help", "This will be the default user for this organisation.")],
)


Expand Down
8 changes: 4 additions & 4 deletions caseworker/queues/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def new_queue_form(request):
return Form(
title=AddQueueForm.TITLE,
description=AddQueueForm.DESCRIPTION,
description="",
questions=[
TextInput(
title=AddQueueForm.Name.TITLE,
Expand All @@ -31,7 +31,7 @@ def new_queue_form(request):
),
Select(
title=AddQueueForm.CountersigningQueue.TITLE,
description=AddQueueForm.CountersigningQueue.DESCRIPTION,
description="",
options=get_queues(
request=request, disable_pagination=True, convert_to_options=True, users_team_first=True
),
Expand All @@ -55,7 +55,7 @@ def remove_current_queue_id(options, queue_id):
def edit_queue_form(request, queue_id):
return Form(
title=EditQueueForm.TITLE,
description=EditQueueForm.DESCRIPTION,
description="",
questions=[
TextInput(
title=EditQueueForm.Name.TITLE,
Expand All @@ -64,7 +64,7 @@ def edit_queue_form(request, queue_id):
),
Select(
title=EditQueueForm.CountersigningQueue.TITLE,
description=EditQueueForm.CountersigningQueue.DESCRIPTION,
description="",
options=remove_current_queue_id(
get_queues(
request=request, disable_pagination=True, convert_to_options=True, users_team_first=True
Expand Down
2 changes: 1 addition & 1 deletion caseworker/teams/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def add_team_form():
return Form(
title=AddTeamForm.TITLE,
description=AddTeamForm.DESCRIPTION,
description="",
questions=[
TextInput(title=AddTeamForm.Name.TITLE, description=AddTeamForm.Name.DESCRIPTION, name="name"),
RadioButtons(
Expand Down
2 changes: 1 addition & 1 deletion caseworker/templates/core/error.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% extends "error.html" %}

{% block description %}{{ description|markdown }}{% endblock %}
{% block description %}{{ description }}{% endblock %}
12 changes: 6 additions & 6 deletions caseworker/users/forms/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
def add_role(request: HttpRequest):
return Form(
title=AddRoleForm.TITLE,
description=AddRoleForm.DESCRIPTION,
description="",
questions=[
TextInput(title=AddRoleForm.ROLE_NAME, name="name"),
Checkboxes(
name="permissions[]",
options=get_permissions(request, True),
title=AddRoleForm.PERMISSION_CHECKBOXES_TITLE,
description=AddRoleForm.PERMISSION_CHECKBOXES_DESCRIPTION,
description="",
optional=True,
classes=["govuk-checkboxes--small"],
),
Checkboxes(
name="statuses[]",
options=get_statuses(request, True),
title=AddRoleForm.STATUSES_CHECKBOXES_TITLE,
description=AddRoleForm.STATUSES_CHECKBOXES_DESCRIPTION,
description="",
optional=True,
classes=["govuk-checkboxes--small"],
),
Expand All @@ -38,22 +38,22 @@ def add_role(request: HttpRequest):
def edit_role(request: HttpRequest):
return Form(
title=EditRoleForm.TITLE,
description=EditRoleForm.DESCRIPTION,
description="",
questions=[
TextInput(title=EditRoleForm.ROLE_NAME, name="name"),
Checkboxes(
name="permissions[]",
options=get_permissions(request, True),
title=EditRoleForm.PERMISSION_CHECKBOXES_TITLE,
description=EditRoleForm.PERMISSION_CHECKBOXES_DESCRIPTION,
description="",
optional=True,
classes=["govuk-checkboxes--small"],
),
Checkboxes(
name="statuses[]",
options=get_statuses(request, True),
title=AddRoleForm.STATUSES_CHECKBOXES_TITLE,
description=AddRoleForm.STATUSES_CHECKBOXES_DESCRIPTION,
description="",
optional=True,
classes=["govuk-checkboxes--small"],
),
Expand Down
12 changes: 6 additions & 6 deletions caseworker/users/forms/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ def add_user_form(request):
TextInput(title=AddUserForm.Email.TITLE, description=AddUserForm.Email.DESCRIPTION, name="email"),
Select(
title=AddUserForm.Team.TITLE,
description=AddUserForm.Team.DESCRIPTION,
description="",
name="team",
options=get_teams(request, True),
),
Select(
title=AddUserForm.Role.TITLE,
description=AddUserForm.Role.DESCRIPTION,
description="",
name="role",
options=get_roles(request, True),
),
Select(
title=AddUserForm.DefaultQueue.TITLE,
description=AddUserForm.DefaultQueue.DESCRIPTION,
description="",
name="default_queue",
options=get_queues(request, include_system=True, convert_to_options=True),
),
Expand All @@ -46,7 +46,7 @@ def edit_user_form(request, user, can_edit_role: bool, can_edit_team: bool):
can_edit_team,
Select(
title=EditUserForm.Team.TITLE,
description=EditUserForm.Team.DESCRIPTION,
description="",
name="team",
options=get_teams(request, True),
),
Expand All @@ -55,14 +55,14 @@ def edit_user_form(request, user, can_edit_role: bool, can_edit_team: bool):
can_edit_role,
Select(
title=EditUserForm.Role.TITLE,
description=EditUserForm.Role.DESCRIPTION,
description="",
name="role",
options=get_roles(request, True),
),
),
Select(
title=EditUserForm.DefaultQueue.TITLE,
description=EditUserForm.DefaultQueue.DESCRIPTION,
description="",
name="default_queue",
options=get_queues(request, include_system=True, convert_to_options=True),
),
Expand Down
4 changes: 3 additions & 1 deletion exporter/applications/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ def back_to_task_list(application_id):

def footer_label(application_id):
url = reverse("applications:task_list", kwargs={"pk": str(application_id)})
return Label(f'Or <a class="govuk-link" href="{url}">return to application overview</a>')
return Label(
f'Or <a class="govuk-link govuk-link--no-visited-state" rel="noreferrer noopener" target="_blank" href="{url}">return to application overview</a>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just interested, but what is this change achieving?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.footer_label = footer_label

Looks like it's used to add a link to the footer.
Yes I could add it to the template and be done with. But I question how far do I go with this PR. For now the aim is to just ensure we can remove the markdown method and make it clearer where it was used and replace the constants along the way.

)
14 changes: 7 additions & 7 deletions exporter/applications/forms/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ def application_copy_form(application_type=None):

def exhibition_details_form(application_id):
return Form(
title=strings.Exhibition.EXHIBITION_TITLE,
title="Exhibition details",
questions=[
TextInput(title=strings.Exhibition.TITLE, name="title"),
TextInput(title="Name", name="title"),
DateInput(
title=strings.Exhibition.FIRST_EXHIBITION_DATE,
description=strings.Exhibition.DATE_DESCRIPTION,
title="Exhibition start date",
description="Exhibition start date",
prefix="first_exhibition_date",
name="first_exhibition_date",
),
DateInput(
title=strings.Exhibition.REQUIRED_BY_DATE,
description=strings.Exhibition.DATE_DESCRIPTION,
title="Date the clearance is needed",
description="For example, 12 11 2020",
prefix="required_by_date",
name="required_by_date",
),
TextArea(
title=strings.Exhibition.REASON_FOR_CLEARANCE,
title="The reason the clearance is needed by this date",
name="reason_for_clearance",
optional=True,
extras={"max_length": 2000},
Expand Down
6 changes: 3 additions & 3 deletions exporter/applications/forms/countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def countries_form(request, application_id):
return Form(
title=strings.applications.DestinationForm.TITLE,
description=strings.applications.DestinationForm.DESCRIPTION,
description="",
questions=[
Filter(),
Checkboxes(
Expand All @@ -28,7 +28,7 @@ def countries_form(request, application_id):
def choose_contract_type_form():
return Form(
title=contractTypeStrings.ChooseContractTypeForm.TITLE,
description=contractTypeStrings.ChooseContractTypeForm.DESCRIPTION,
description="Examples of sectors and contract types are ‘army’, ‘registered firearm dealers’ and ‘for the exporters own use’.",
questions=[
RadioButtons(
"choice",
Expand All @@ -46,7 +46,7 @@ def choose_contract_type_form():
def contract_type_per_country_form(current_country, country_name):
return Form(
title=contractTypeStrings.AddContractTypesForm.TITLE + country_name,
description=contractTypeStrings.AddContractTypesForm.DESCRIPTION,
description="",
questions=[
HiddenField("countries", current_country),
Checkboxes(
Expand Down
Loading