From 4c0eaca9499b384285a2f245ad73058b32bed988 Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Sun, 11 Jun 2023 10:54:16 +0100 Subject: [PATCH] Update guide link examples to use keyword args Now we're using the new link helper we need to use keyword arguments instead of hashes or arrays. --- guide/lib/examples/link_helpers.rb | 20 ++++++++++---------- guide/lib/helpers.rb | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/guide/lib/examples/link_helpers.rb b/guide/lib/examples/link_helpers.rb index 44086c69..98a1a394 100644 --- a/guide/lib/examples/link_helpers.rb +++ b/guide/lib/examples/link_helpers.rb @@ -16,23 +16,23 @@ def govuk_link_to_new_tab end def govuk_link_to_inverse - %(= govuk_link_to('An inverse hyperlink', '#', { inverse: true })) + %(= govuk_link_to('An inverse hyperlink', '#', inverse: true)) end def govuk_link_to_muted - %(= govuk_link_to('A muted hyperlink', '#', { muted: true })) + %(= govuk_link_to('A muted hyperlink', '#', muted: true)) end def govuk_link_other_styles <<~LINKS p - = govuk_link_to('A hyperlink without an underline', '#', { no_underline: true }) + = govuk_link_to('A hyperlink without an underline', '#', no_underline: true ) p - = govuk_link_to('A hyperlink without a visited state', '#', { no_visited_state: true }) + = govuk_link_to('A hyperlink without a visited state', '#', no_visited_state: true) p - = govuk_link_to('A text-coloured hyperlink', '#', { text_colour: true }) + = govuk_link_to('A text-coloured hyperlink', '#', text_colour: true) LINKS end @@ -46,16 +46,16 @@ def govuk_button_link_to_normal def govuk_button_inverse <<~BUTTON - = govuk_button_link_to('An inverse button', '#', { inverse: true }) + = govuk_button_link_to('An inverse button', '#', inverse: true) BUTTON end def govuk_button_other_styles <<~BUTTONS .govuk-button-group - = govuk_button_link_to('A disabled button', '#', { disabled: true }) - = govuk_button_link_to('A secondary button', '#', { secondary: true }) - = govuk_button_link_to('A warning button', '#', { warning: true }) + = govuk_button_link_to('A disabled button', '#', disabled: true) + = govuk_button_link_to('A secondary button', '#', secondary: true) + = govuk_button_link_to('A warning button', '#', warning: true) BUTTONS end @@ -71,7 +71,7 @@ def govuk_link_classes_multiple = link_to_if(true, 'A muted and not underlined link generated by Rails', '#', - class: govuk_link_classes(:muted, :no_underline)) + class: govuk_link_classes(muted: true, no_underline: true)) LINK end end diff --git a/guide/lib/helpers.rb b/guide/lib/helpers.rb index 72246793..42e5cd85 100644 --- a/guide/lib/helpers.rb +++ b/guide/lib/helpers.rb @@ -110,3 +110,5 @@ class Application < Rails::Application; end use_helper Examples::CommonOptionsHelpers use_helper Examples::BackToTopLinkHelpers use_helper Examples::TitleWithErrorPrefixHelpers + +ActiveSupport.on_load(:action_view) { include GovukLinkHelper }