-
Notifications
You must be signed in to change notification settings - Fork 352
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
Support nil value for label parameter #457
Comments
Thanks for the suggestion, Santiago. I see what the problem is. My only concern with the proposed solution is that it might break existing code being migrated from the Bootstrap 3 version of this gem. I assume from your example that you're using Bootstrap 4. I checked the behaviour of the Bootstrap 3 version of the gem. If you specify I did a fair bit of work in Thanks again for raising this issue! |
@santiagodoldan this is due to how
Easy work-around: |
The reason For the issue of how to generate an empty label, I see three possible solutions:
I don't see any of these as a clear winner, but my preference is for 2., then 3., then 1. @mattbrictson (and anyone else), your thoughts? |
I agree that a new option would be better, |
@santiagodoldan Let us know if you plan to send a PR for this. We'd love to have your contribution and would be very thankful for a PR. |
Sure thing, will try to add it this week |
I'm late to this discussion, but if I may play devil's advocate for a bit? We already have Do either of those work for your use case? I am not sure why you'd want to keep a
Or maybe less esoteric:
I guess my point is that adding another Could we add one of these workarounds to the UPGRADE-4.0 doc instead? |
I was reluctant to add yet another option, but the Santiago's use case requires an empty label to work with another plugin. But that's arguably enough of an edge case that I now agree that we should just document the "zero width space" trick. @santiagodoldan could you please look at Matt's comment and see if it's good enough for your use case? |
Looks like passing
nil
or an empty string to the label parameter does not remove the text, it shows the attribute name, I was wondering if it could be a good idea to support nil to remove that text, in my case I was trying to use the check_box helper method and trying to integrate it with a bootstrap switch plugin which only uses css, so it needs a label without content.If this is something that can be merge, I'd love to create a PR for it.
Here an example
= f.check_box :name
= f.check_box :name, label: nil
The text was updated successfully, but these errors were encountered: