Skip to content

Commit

Permalink
Update guide link examples to use keyword args
Browse files Browse the repository at this point in the history
Now we're using the new link helper we need to use keyword arguments
instead of hashes or arrays.
  • Loading branch information
peteryates committed Nov 2, 2023
1 parent be0fe9c commit 4c0eaca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 10 additions & 10 deletions guide/lib/examples/link_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions guide/lib/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

0 comments on commit 4c0eaca

Please sign in to comment.