-
Notifications
You must be signed in to change notification settings - Fork 222
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
Allow value option on labels for easier building of dynamic radio buttons/checkboxes #203
Allow value option on labels for easier building of dynamic radio buttons/checkboxes #203
Conversation
This will allow labels to be used with dynamically created radiobuttons and checkboxes to have the correct prefix
Thanks @mintcore! I see the need for this feature but I don't like using Thoughts? |
It's a good point @josevalim! I've thought about that some too but wanted to hear more opinions on it. I'll take some time to think and get back on it when i've got some new ideas! |
One option is to introduce this: label :user do
radio_button :user, :level, :gold
end Because if the input is inside the label, you don't need |
One way could be to allow label :user, {:level, :gold} do
radio_button :user, :level, :gold
end But it does not feel like something anyone would figure out by themselves and therefore not that good. |
That is true! While it covers many cases I'm afraid it won't cover them all. I better update the code above to show that case instead of the wrapped one |
@mintcore for the remaining cases you can always pass |
@josevalim True! So that basically means we can close this, right? |
@mintcore not quite because we don't support label block but I am adding it now. :) |
@josevalim Let me know if there is anything more I can do! |
Now in master, thanks! :) |
This will allow labels to be used with dynamically created radiobuttons and checkboxes to have the correct prefix.
For example this will now be allowed:
which will produce:
It'll be an improvement over the current way where you'd either have to build the
for
attribute yourself.Could be a followup on #195