Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New link helpers #419

Merged
merged 4 commits into from
Nov 26, 2023
Merged

New link helpers #419

merged 4 commits into from
Nov 26, 2023

Commits on Nov 24, 2023

  1. Add new set of link and button helpers

    These are clean implementations of that significantly simplify the
    codebase and allow us to easily support features of the design
    system, like opening links in new tabs. The new methods are:
    
    * govuk_link_to
    * govuk_button_to
    * govuk_button_link_to
    * govuk_link_classes
    * govuk_button_classes
    * govuk_breadcrumb_link_to
    
    They drop support for Rails' legacy-style link building where the
    action, controller and id arguments were passed in. Rails discourages
    their use in the API docs[0]:
    
    > Because it relies on url_for, link_to supports both older-style
    > controller/action/id arguments and newer RESTful routes. Current Rails
    > style favors RESTful routes whenever possible, so base your application
    > on resources and use
    
    [0] https://api.rubyonrails.org/v7.0/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
    peteryates committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    65c7947 View commit details
    Browse the repository at this point in the history
  2. Replace Nanoc's LinkTo with Rails' UrlHelper

    Nanoc's link helpers expect classes to be provided in a string but now
    we're using arrays internally throughout so it makes sense to use the
    Rails version.
    peteryates committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    e925f0a View commit details
    Browse the repository at this point in the history
  3. 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.
    peteryates committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    3a4ec34 View commit details
    Browse the repository at this point in the history
  4. Reword error messages for bad class combinations

    Co-authored-by: Frankie Roberto <frankie@frankieroberto.com>
    peteryates and frankieroberto committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    ceba1d0 View commit details
    Browse the repository at this point in the history