stouset / twitter_bootstrap_form_for

A Rails FormBuilder DSL for generating Twitter Bootstrap forms
https://github.com/stouset/twitter_bootstrap_form_for
MIT License
409 stars 110 forks source link

Add support for passing html options to #inputs #18

Closed pivotale20 closed 12 years ago

pivotale20 commented 12 years ago

We wanted to add class names to our fieldsets, so we added a way to do it a la SimpleForm by passing in :fieldset_html

There are a lot of other places it could make sense to do the same thing.

stouset commented 12 years ago

I think in this case, given that the fieldset is the whole point of the method, it'd be fine to make the options implicitly HTML options on the fieldset itself (i.e, no :fieldset_html wrapper). Do you mind making this change and resubmitting the pull request?

pivotale20 commented 12 years ago

The reason we did it as :fieldset_html was that if in the future someone wants to do :legend_html it would be a nice way to split them out.

That said, you are right, the whole point is to create a fieldset wrapping the block, so I think :html makes sense. It matches how form_tag works.

pivotale20 commented 12 years ago

Done!

stouset commented 12 years ago

If we need to do overrides later for the <legend> (unlikely, but maybe), then we'll do a :legend_html for that.

stouset commented 12 years ago

Sorry, I might not have been clear in my description of how I wanted it done. Can you remove the :html scoping entirely? You should be able to just call it like:

    f.inputs('Sign up', :class => 'sign_up')
stouset commented 12 years ago

I merged this in, but tweaked it to remove the extra hash layer.

stouset commented 12 years ago

1.0.3 has been released with this fix included.