Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add ability to use CSS class for label of item in the collection for radio and checkbox. #717

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
5 participants

No description provided.

Collaborator

rafaelfranca commented Dec 28, 2012

Thank you.

Why do you need it?

When using twitter bootstrap, with the combination of sibling selectors, this allows presentation of labels as bootstrap-styled buttons.

@rafaelfranca rafaelfranca commented on an outdated diff Jan 1, 2013

lib/simple_form/action_view_extensions/builder.rb
@@ -97,7 +99,8 @@ def collection_radio_buttons(attribute, collection, value_method, text_method, o
if block_given?
yield builder
else
- builder.radio_button + builder.label(:class => "collection_radio_buttons")
+ item_label_class = options[:item_label_class]
@rafaelfranca

rafaelfranca Jan 1, 2013

Collaborator

I dont think we need this local variable.

builder.radio_button + builder.label(:class => "collection_radio_buttons #{options[:item_label_class]}".strip)
Collaborator

rafaelfranca commented Jan 2, 2013

Seems good.

@carlosantoniodasilva @nashby objections?

Collaborator

nashby commented Jan 2, 2013

@rafaelfranca looks good. And we definitely need to mention these options in README.

Collaborator

carlosantoniodasilva commented Jan 14, 2013

I'd rather not add new options/APIs considering that you're able to achieve the same results with the currently supported block version. The idea of adding support for blocks with the builder was for people that need to customize the output somehow (a very frequent question), and label classes seem to fall into that category.

@yurikoval can you give a bit more context about the problem you're trying to solve, with some code examples? Thanks.

Collaborator

rafaelfranca commented Jan 22, 2013

Yes. Agree with @carlosantoniodasilva.

@yurikoval thank you for the pull request

flyfy1 commented Aug 23, 2017

I have similar needs -- our own style guide requires me to apply a class on the item level of a collection.

Regarding with the currently supported block version, would anyone point me to the reference for that? Thanks! @carlosantoniodasilva @rafaelfranca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment