You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
label_class ignored on collection_check_boxes #535
I want to add additional classes to the checkboxes in a collection rendered with collection_check_boxes. According to the documentation, "Other options [than :label, :hide_label, :help] will be forwarded to the radio_button/check_box method".
But the class is not added to the checkboxes within the collection.
Digging into the code, the option is present in the call to BootstrapForm::Inputs::InputsCollection#inputs_collection. But BootstrapForm::FormGroupBuilder#form_group_builder filters :label_class (amongst others) from options and this filtered options leak into the calling method. Or is this intended?
Thank you for the detailed report. We appreciate all feedback, but you've provided lots of useful information for us. On the odd chance that you have time to submit a pull request, feel free to do so. If you plan to submit a PR, just assign this issue to yourself (upper left of this page). Otherwise, we will look into it.
It looks like the documentation has not been keeping up-to-date with the code. A number of options are not forwarded to the radio_button and check_box methods, but this is on purpose.
However, I believe I may have seen what's causing you a problem. Before I actually make any changes, can you please clarify which options you're trying to pass through to the check box and/or its label?
We can't change what :label_class on collection_check_boxes does. It sets the class on the label for the group of buttons, so we can't also use it to pass a class down to the labels of the individual check boxes without breaking existing code that uses collection_check_boxes.
I suspect the fix to #477 would help in your case. A block on collection_check_boxes would allow you to call check_box directly with whatever options you want. What do you think?
Activity
lcreid commentedon Jun 16, 2019
Thank you for the detailed report. We appreciate all feedback, but you've provided lots of useful information for us. On the odd chance that you have time to submit a pull request, feel free to do so. If you plan to submit a PR, just assign this issue to yourself (upper left of this page). Otherwise, we will look into it.
lcreid commentedon Jun 23, 2019
It looks like the documentation has not been keeping up-to-date with the code. A number of options are not forwarded to the
radio_buttonandcheck_boxmethods, but this is on purpose.However, I believe I may have seen what's causing you a problem. Before I actually make any changes, can you please clarify which options you're trying to pass through to the check box and/or its label?
JochenLutz commentedon Jul 1, 2019
For my use case, I need to pass
:label_classto the labels.lcreid commentedon Jul 2, 2019
Thanks. That helps clarify things.
We can't change what
:label_classoncollection_check_boxesdoes. It sets the class on the label for the group of buttons, so we can't also use it to pass a class down to the labels of the individual check boxes without breaking existing code that usescollection_check_boxes.I suspect the fix to #477 would help in your case. A block on
collection_check_boxeswould allow you to callcheck_boxdirectly with whatever options you want. What do you think?JochenLutz commentedon Jul 2, 2019
A fix of #477 would definitely help me. As a matter of fact, my current workaround is to use
collection_check_boxes_without_bootstrap.