Skip to content

Commit

Permalink
Fixup: passing error_items
Browse files Browse the repository at this point in the history
Had to switch from `errors_for_input` (which squashes to a string)
to `errors_for` (which converts to an array of hashes as expected)
The `errors_for_input` class should only really be used by the
`input` component (as explained in the commit that introduces
the method: 39b42e9)
  • Loading branch information
ChrisBAshton committed Feb 20, 2025
1 parent f3a1b16 commit aafd541
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name: "edition[corporate_information_page_type_id]",
label: "Type",
heading_size: "l",
error_message: errors_for_input(edition.errors, :corporate_information_page_type_id),
error_items: errors_for(edition.errors, :corporate_information_page_type_id),
include_blank: true,
options: corporate_information_page_types(@organisation).map do |type, value|
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name: "social_media_account[social_media_service_id]",
heading_size: "l",
include_blank: true,
error_message: errors_for_input(social_media_account.errors, :social_media_service_id),
error_items: errors_for(social_media_account.errors, :social_media_service_id),
options: SocialMediaService.all.map do |service|
{
text: service.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
label: "Field of operation (required)",
name: "edition[operational_field_id]",
heading_size: "l",
error_message: errors_for_input(edition.errors, :operational_field_id),
error_items: errors_for(edition.errors, :operational_field_id),
include_blank: true,
options: OperationalField.all.map do |operation|
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
label: "News article type (required)",
heading_size: "l",
value: edition.news_article_type_id,
error_message: errors_for_input(edition.errors, :news_article_type_id),
error_items: errors_for(edition.errors, :news_article_type_id),
include_blank: true,
options: NewsArticleType.all.map do |type|
{
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/organisations/_closed_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: "organisation[govuk_closed_status]",
id: "organisation_govuk_closed_status",
heading_size: "m",
error_message: errors_for_input(organisation.errors, :govuk_closed_status),
error_items: errors_for(organisation.errors, :govuk_closed_status),
include_blank: true,
options: [
{
Expand Down
6 changes: 3 additions & 3 deletions app/views/admin/organisations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
name: "organisation[organisation_logo_type_id]",
id: "organisation_organisation_logo_type_id",
heading_size: "l",
error_message: errors_for_input(organisation.errors, :organisation_logo_type_id),
error_items: errors_for(organisation.errors, :organisation_logo_type_id),
include_blank: true,
options: OrganisationLogoType.all.map do |logo_type|
{
Expand Down Expand Up @@ -77,7 +77,7 @@
name: "organisation[organisation_brand_colour_id]",
id: "organisation_organisation_brand_colour_id",
heading_size: "l",
error_message: errors_for_input(organisation.errors, :organisation_brand_colour_id),
error_items: errors_for(organisation.errors, :organisation_brand_colour_id),
include_blank: true,
options: OrganisationBrandColour.all.map do |brand_colour|
{
Expand Down Expand Up @@ -122,7 +122,7 @@
name: "organisation[organisation_type_key]",
id: "organisation_organisation_type_key",
heading_size: "l",
error_message: errors_for_input(organisation.errors, :organisation_type_key),
error_items: errors_for(organisation.errors, :organisation_type_key),
include_blank: true,
options: OrganisationType.in_listing_order.map do |type|
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
label: "Publication type (required)",
heading_size: "l",
value: edition.publication_type_id,
error_message: errors_for_input(edition.errors, :publication_type_id),
error_items: errors_for(edition.errors, :publication_type_id),
include_blank: true,
grouped_options: [
[
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/role_appointments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
form.object.new_record? || option[:selected]
end,
include_blank: form.object.new_record?,
error_message: errors_for_input(form.object.errors, :person_id),
error_items: errors_for(form.object.errors, :person_id),
} %>

<% if form.object.new_record? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/social_media_accounts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name: "social_media_account[social_media_service_id]",
heading_size: "l",
include_blank: true,
error_message: errors_for_input(social_media_account.errors, :social_media_service_id),
error_items: errors_for(social_media_account.errors, :social_media_service_id),
options: SocialMediaService.all.map do |service|
{
text: service.name,
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/speeches/_speaker_select_field.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
id: "edition_role_appointment_id",
name: "edition[role_appointment_id]",
label: "",
error_message: errors_for_input(edition.errors, :role_appointment_id),
error_items: errors_for(edition.errors, :role_appointment_id),
include_blank: true,
options: taggable_role_appointments_container([edition.role_appointment_id]),
} %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/speeches/_speech_type_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
label: "Speech type",
heading_size: "l",
value: edition.speech_type_id,
error_message: errors_for_input(edition.errors, :speech_type_id),
error_items: errors_for(edition.errors, :speech_type_id),
include_blank: true,
options: SpeechType.primary.map do |type|
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
name: "worldwide_organisation_page[corporate_information_page_type_id]",
label: "Type",
heading_size: "l",
error_message: errors_for_input(worldwide_organisation_page.errors, :corporate_information_page_type_id),
error_items: errors_for(worldwide_organisation_page.errors, :corporate_information_page_type_id),
include_blank: true,
options: corporate_information_page_types(@worldwide_organisation).map do |type, value|
{
Expand Down

0 comments on commit aafd541

Please sign in to comment.