Skip to content

Commit

Permalink
remove markdown from component
Browse files Browse the repository at this point in the history
  • Loading branch information
depsiatwal committed Oct 30, 2024
1 parent 0df0d9f commit d66c78e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 80 deletions.
10 changes: 5 additions & 5 deletions caseworker/letter_templates/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,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,
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
4 changes: 2 additions & 2 deletions caseworker/queues/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions caseworker/users/forms/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ def add_role(request: HttpRequest):
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 @@ -45,15 +45,15 @@ def edit_role(request: HttpRequest):
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
2 changes: 1 addition & 1 deletion exporter/applications/forms/goods_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def goods_type_form(request, application_type: str):
),
RadioButtons(
title=CreateGoodsTypeForm.IsIncorporated.TITLE,
description=CreateGoodsTypeForm.IsIncorporated.DESCRIPTION,
description="",
name="is_good_incorporated",
options=[
Option(key=True, value=CreateGoodsTypeForm.IsIncorporated.YES),
Expand Down
2 changes: 1 addition & 1 deletion exporter/compliance/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def open_licence_return_form_group():
questions=[
Select(
title=OpenReturnsForm.Year.FIELD_TITLE,
description=OpenReturnsForm.Year.FIELD_DESCRIPTION,
description="",
name="year",
options=get_years(),
)
Expand Down
47 changes: 1 addition & 46 deletions lite_forms/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ def __init__(
classes: Optional[List] = None,
extras=None,
):
from lite_forms.helpers import convert_to_markdown

self.name = name
self.title = title
self.description = convert_to_markdown(description)
self.description = description
self.short_title = short_title or title
self.accessible_description = accessible_description
self.optional = optional
Expand Down Expand Up @@ -130,21 +128,6 @@ def __init__(
self.input_type = "label"


class GroupWithLabel(_Component):
def __init__(
self,
text: str = None,
id: str = None,
components: Optional[List] = None,
classes: Optional[List] = None,
):
super().__init__(text, classes)
self.id = id
self.components = [EmptyLabel()] + components
self.classes = classes
self.input_type = "group"


class Form:
def __init__(
self,
Expand Down Expand Up @@ -255,34 +238,6 @@ def __init__(
self.input_type = "email_input"


class NumberInput(_Component):
def __init__(
self,
name: str,
title: str = "",
description: str = "",
accessible_description: str = None,
optional: bool = False,
classes: Optional[List] = None,
):
super().__init__(name, title, description, accessible_description, optional, classes)
self.input_type = "number_input"


class QuantityInput(_Component):
def __init__(
self,
name: str,
title: str = "",
description: str = "",
accessible_description: str = None,
optional: bool = False,
classes: Optional[List] = None,
):
super().__init__(name, title, description, accessible_description, optional, classes)
self.input_type = "quantity_input"


class CurrencyInput(_Component):
def __init__(
self,
Expand Down
15 changes: 0 additions & 15 deletions lite_forms/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
DetailComponent,
TextInput,
FormGroup,
_Component,
Label,
Option,
BackLink,
Expand Down Expand Up @@ -194,20 +193,6 @@ def test_prefix_dots(self):
self.assertEqual(r"\\.all\\.the\\.dots\\.", prefix_dots(".all.the.dots."))


class MarkdownTest(TestCase):
def setUp(self):
super().setUp()
self.markdown_description = "Please **Click** this [link](https://www.gov.uk/)"
self.html_description = (
'Please <strong>Click</strong> this <a class="govuk-link govuk-link--no-visited-state" '
'rel="noreferrer noopener" target="_blank" href="https://www.gov.uk/">link</a>'
)

def test_generic_component(self):
component = _Component(name="a", description=self.markdown_description)
self.assertEqual(component.description, self.html_description)


class SingleQuestionFormAccessibilityTest(TestCase):
def test_no_questions_no_title_label(self):
form = Form()
Expand Down

0 comments on commit d66c78e

Please sign in to comment.