From 241d2ba6aee4dd3718157468c032b2b992f2dd96 Mon Sep 17 00:00:00 2001 From: AshGDS <8880610+AshGDS@users.noreply.github.com> Date: Fri, 24 Jan 2025 10:59:42 +0000 Subject: [PATCH 1/2] Use component wrapper on result section component --- app/views/components/_result_sections.html.erb | 7 +++++-- app/views/components/docs/result_sections.yml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/components/_result_sections.html.erb b/app/views/components/_result_sections.html.erb index fd9bff69253..74b75ee7027 100644 --- a/app/views/components/_result_sections.html.erb +++ b/app/views/components/_result_sections.html.erb @@ -7,8 +7,11 @@ if !topics.any? raise ArgumentError, "The result section component requires topics data" end + + component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) + component_helper.add_class("app-c-result-sections") %> -
+<%= tag.div(**component_helper.all_attributes) do %> <% topics.each do |topic, results| %>

<%= topic %>

@@ -22,4 +25,4 @@ <% end %>
<% end %> -
+<% end %> diff --git a/app/views/components/docs/result_sections.yml b/app/views/components/docs/result_sections.yml index 68c1497aa78..09718fce601 100644 --- a/app/views/components/docs/result_sections.yml +++ b/app/views/components/docs/result_sections.yml @@ -2,6 +2,7 @@ name: Result section description: Groups a set of results items under a common title shared_accessibility_criteria: - link +uses_component_wrapper_helper: true examples: default: data: From 7b570be73241a2def5c15f7d325a3397d6b61385 Mon Sep 17 00:00:00 2001 From: AshGDS <8880610+AshGDS@users.noreply.github.com> Date: Fri, 24 Jan 2025 11:46:36 +0000 Subject: [PATCH 2/2] Fix component guide previews on result section The result section data was invalid and therefore crashing. --- app/views/components/docs/result_sections.yml | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/app/views/components/docs/result_sections.yml b/app/views/components/docs/result_sections.yml index 09718fce601..83c28558fc1 100644 --- a/app/views/components/docs/result_sections.yml +++ b/app/views/components/docs/result_sections.yml @@ -6,29 +6,30 @@ uses_component_wrapper_helper: true examples: default: data: - title: Business tax - results: + topics: + business_tax: - title: "Register for Corporation Tax" url: "/corporation-tax" description: "You need to register for corporation tax within 3 months of starting to do business, if you haven’t done so already." with-multiple-items: data: - title: Business tax - results: - - title: "Register for Corporation Tax" - url: "/corporation-tax" - description: "You need to register for corporation tax within 3 months of starting to do business, if you haven’t done so already." - - title: "Register for VAT" - url: "/vat-registration" - description: "You need to register your business for VAT if your VAT taxable turnover is more than £85,000." + topics: + business_tax: + - title: "Register for Corporation Tax" + url: "/corporation-tax" + description: "You need to register for corporation tax within 3 months of starting to do business, if you haven’t done so already." + - title: "Register for VAT" + url: "/vat-registration" + description: "You need to register your business for VAT if your VAT taxable turnover is more than £85,000." with-multiple-highlighted-items: data: - title: Business tax - highlighted: true - results: - - title: "Register for Corporation Tax" - url: "/corporation-tax" - description: "You need to register for corporation tax within 3 months of starting to do business, if you haven’t done so already." - - title: "Register for VAT" - url: "/vat-registration" - description: "You need to register your business for VAT if your VAT taxable turnover is more than £85,000." + topics: + business_tax: + - title: "Register for Corporation Tax" + url: "/corporation-tax" + description: "You need to register for corporation tax within 3 months of starting to do business, if you haven’t done so already." + highlighted: true + - title: "Register for VAT" + url: "/vat-registration" + description: "You need to register your business for VAT if your VAT taxable turnover is more than £85,000." + highlighted: true