Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

label_class ignored on collection_check_boxes #535

Open

Description

@JochenLutz

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

Activity

  1. lcreid commented on Jun 16, 2019

    @lcreid
    Contributor

    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.

  2. self-assigned this
    on Jun 23, 2019
  3. lcreid commented on Jun 23, 2019

    @lcreid
    Contributor

    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?

  4. JochenLutz commented on Jul 1, 2019

    @JochenLutz
    Author

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

  5. lcreid commented on Jul 2, 2019

    @lcreid
    Contributor

    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?

  6. JochenLutz commented on Jul 2, 2019

    @JochenLutz
    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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions