-
Notifications
You must be signed in to change notification settings - Fork 22
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
Unable to set label content #177
Comments
This happens because the The proc is expecting Ruby rather than ERB, but you can render whatever you like via /_name_label.slim
| Building and street
span.govuk-visually-hidden
| line 1 of 2 /_form.slim
= form_for @person do |f|
= f.govuk_text_field :name, label: ->{ render partial: 'name_label' } Alternatively, using a helper: module PeopleHelper
def name_label
safe_join(["Building and street", tag.span("line 1 of 2", class: 'govuk-visually-hidden')])
end
end Or just inline: = f.govuk_text_field :name,
label: ->{ safe_join(["Building and street", tag.span("line 1 of 2", class: 'govuk-visually-hidden')]) } Hope this helps. In your example, passing |
Thanks for info! Honestly, this is all gibberish to me (I make edits to our Ruby app purely by trail and error!), but the inline method works for me. Might it be possible to add a similar example to the docs? We don’t use Slim templates, so the current examples are not helpful, and actually a little confusing. |
I'm going to close this and am continuing to explore adding ERB snippets in #118 Unfortunately, and this was news to me, Rails' ERB isn't standard and using Rails' implementation outside of Rails (the guide is generated using Nanoc) doesn't look like the most straightforward of tasks. On the positive side, Slim only takes about five minutes to learn if you already know CSS selector syntax 😂 |
I’m trying to implement an address pattern using multiple text inputs, as described in the design system. This requires the following HTML:
Looking through the docs, I thought I could achieve this with the following:
However it appears that this replaces all the content of this helper, both the
label
and the textinput
, whereas the documentation suggests this should only replace the content of thelabel
element. Am I misinterpreting the documentation, or is this a bug? /cc @tvararuThe text was updated successfully, but these errors were encountered: