From 3bed57a7a49027cc98158f1d11e42515de90b3de Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Wed, 27 Mar 2024 17:09:00 +0000 Subject: [PATCH] Address some points raised in review * the i18n data attributes should really be used for localisation, they're now Italian (thanks @edujackedu!) * the official component is called 'password input' rather than 'password field'. I've changed this around in the guide but left the actual code as #govuk_password_field so it's consistent with Rails' other form helpers * renamed the example attributes from PIN and secret code to password_1, password_2, password_3. They need to be unique and not encourage people to use this component for things other than passwords --- .../{password.slim => password-input.slim} | 10 ++++----- guide/lib/examples/password.rb | 22 +++++++++---------- guide/lib/helpers/link_helpers.rb | 2 +- guide/lib/helpers/person.rb | 6 ++--- 4 files changed, 20 insertions(+), 20 deletions(-) rename guide/content/form-elements/{password.slim => password-input.slim} (82%) diff --git a/guide/content/form-elements/password.slim b/guide/content/form-elements/password-input.slim similarity index 82% rename from guide/content/form-elements/password.slim rename to guide/content/form-elements/password-input.slim index afe8eb4f..c79c80b4 100644 --- a/guide/content/form-elements/password.slim +++ b/guide/content/form-elements/password-input.slim @@ -1,5 +1,5 @@ --- -title: Password fields +title: Password input --- markdown: @@ -8,17 +8,17 @@ markdown: Use this component whenever you need users to create or enter a password. == render('/partials/example.*', - caption: 'A default password field', + caption: 'A default password input', code: default_password) == render('/partials/example.*', - caption: 'A password field with a custom label, caption and hint', + caption: 'A password input with a custom label, caption and hint', code: password_with_a_captioned_heading_label_and_hint) do markdown: - The password field's title, caption and hint can be customised in the usual way. + The password input's title, caption and hint can be customised in the usual way. == render('/partials/example.*', - caption: 'Password field with custom text', + caption: 'Password input with custom text', code: password_with_custom_text) do markdown: The component's text can be customised or localised by providing the following arguments: diff --git a/guide/lib/examples/password.rb b/guide/lib/examples/password.rb index 602a331b..047756d7 100644 --- a/guide/lib/examples/password.rb +++ b/guide/lib/examples/password.rb @@ -2,14 +2,14 @@ module Examples module Password def default_password <<~PASSWORD - = f.govuk_password_field :password, label: { text: "Enter your password" } + = f.govuk_password_field :password_1, label: { text: "Password" } PASSWORD end def password_with_a_captioned_heading_label_and_hint <<~PASSWORD - = f.govuk_password_field(:pin, - label: { text: "Enter your PIN", tag: "h2", size: "l" }, + = f.govuk_password_field(:password_2, + label: { text: "Password", tag: "h2", size: "l" }, caption: { text: "Security", size: "m" }, hint: { text: "Your PIN was emailed to you when you registered for this service" }) PASSWORD @@ -17,14 +17,14 @@ def password_with_a_captioned_heading_label_and_hint def password_with_custom_text <<~PASSWORD - = f.govuk_password_field(:secret_code, - label: { text: "Enter your secret code" }, - show_password_text: "Display", - hide_password_text: "Conceal", - show_password_aria_label_text: "Display the secret code", - hide_password_aria_label_text: "Conceal the secret code", - password_shown_announcement_text: "The secret code has been displayed", - password_hidden_announcement_text: "The secret code has been concealed") + = f.govuk_password_field(:password_3, + label: { text: "Password", tag: "h2", size: "l" }, + show_password_text: "Mostra", + hide_password_text: "Nascondi", + show_password_aria_label_text: "Mostra la password", + hide_password_aria_label_text: "Nascondi la password", + password_shown_announcement_text: "La password è visibile", + password_hidden_announcement_text: "La password non è visibile") PASSWORD end end diff --git a/guide/lib/helpers/link_helpers.rb b/guide/lib/helpers/link_helpers.rb index 0682b542..c57fa060 100644 --- a/guide/lib/helpers/link_helpers.rb +++ b/guide/lib/helpers/link_helpers.rb @@ -24,7 +24,7 @@ def navigation_links "Checkboxes" => "/form-elements/checkboxes/", "Date input" => "/form-elements/date-input/", "File upload" => "/form-elements/file-upload/", - "Password fields" => "/form-elements/password/", + "Password input" => "/form-elements/password-input/", "Radios" => "/form-elements/radios/", "Select" => "/form-elements/select/", "Submit button" => "/form-elements/submit/", diff --git a/guide/lib/helpers/person.rb b/guide/lib/helpers/person.rb index e9587163..d5b695a5 100644 --- a/guide/lib/helpers/person.rb +++ b/guide/lib/helpers/person.rb @@ -16,9 +16,9 @@ class Person # password examples attr_accessor( - :password, - :pin, - :secret_code + :password_1, + :password_2, + :password_3 ) # width examples