Skip to content
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

label_class ignored on collection_check_boxes #535

Open
JochenLutz opened this issue Jun 12, 2019 · 5 comments
Open

label_class ignored on collection_check_boxes #535

JochenLutz opened this issue Jun 12, 2019 · 5 comments
Assignees
Labels

Comments

@JochenLutz
Copy link

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?

Release used: 4.2.0

@lcreid
Copy link
Contributor

lcreid commented 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 lcreid added the bug? label Jun 16, 2019
@lcreid lcreid self-assigned this Jun 23, 2019
@lcreid
Copy link
Contributor

lcreid commented 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_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?

@JochenLutz
Copy link
Author

For my use case, I need to pass :label_class to the labels.

@lcreid
Copy link
Contributor

lcreid commented Jul 2, 2019

Thanks. That helps clarify things.

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?

@JochenLutz
Copy link
Author

A fix of #477 would definitely help me. As a matter of fact, my current workaround is to use collection_check_boxes_without_bootstrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants