Giter VIP home page Giter VIP logo

Comments (5)

peteryates avatar peteryates commented on July 4, 2024

Strange. I'd expect that for govuk_link_to 'abc', { param1: 'a', param2: 'b' } the hash would end up in args in the govuk_link_to helper but they end up in kwargs, so are merged with the default govuk-link class.

Any thoughts on a better approach that still allows custom classes to be added to the default one?

from govuk-components.

benilovj avatar benilovj commented on July 4, 2024

Any thoughts on a better approach that still allows custom classes to be added to the default one?

Mmm, no, apart from something very hacky like an explicit if statement checking for a hash...

@tijmenb any ideas?

from govuk-components.

peteryates avatar peteryates commented on July 4, 2024

For what it's worth, I just retested what I did earlier using the dummy app rather than specs and this gives you the result you're after:

<%= govuk_link_to 'abc', { param1: 'a', param2: 'b' } %>

Not wrapping the query params in braces makes them end up in kwargs rather than args. The helper then adjusts kwargs to deep merge the appropriate links classes.

from govuk-components.

peteryates avatar peteryates commented on July 4, 2024

@benilovj - is providing the extra args in a hash a suitable fix/workaround here?

from govuk-components.

peteryates avatar peteryates commented on July 4, 2024

I'm closing this for the time being, I think the answer above covers why the behaviour occurs and how to avoid it. Agree it's not ideal, happy to revisit if it proves to remain a problem.

from govuk-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.