Created
December 5, 2011 16:04
-
-
Save stayhero/1434089 to your computer and use it in GitHub Desktop.
Simple Form (Master): :input_html class option gets added to container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After upgrading simple_form to current master, my design slightly broke because a class defined | |
in :input_html options gets added to surrounding container. Is that desired behaviour? I'm using | |
the wrapper sample options for Twitter Bootstrap: | |
https://github.com/rafaelfranca/simple_form-bootstrap/blob/master/config/initializers/simple_form.rb | |
Example (haml): | |
= simple_form_for @company_profile, wrapper: :inline, url: company_profile_path | |
= f.input :zipcode, label: t('common.zipcode'), input_html: {class: 'span2', 'data-xxx' => true} | |
Resulting HTML: | |
<form accept-charset="UTF-8" action="/company_profile" class="simple_form edit_company_profile" data-remote="true" id="edit_company_profile_1" method="post" novalidate="novalidate"> | |
<div style="margin:0;padding:0;display:inline"> | |
<input name="utf8" type="hidden" value="✓" /> | |
<input name="_method" type="hidden" value="put" /> | |
<input name="authenticity_token" type="hidden" value="qUrINhA5ZTBcDWzoIV5qyLFK/iJO5z5t3YQtdZBbNIA=" /> | |
</div> | |
<div class="clearfix string optional span2"> | |
<label class="string optional " for="company_profile_zipcode">Zip Code </label> | |
<div class="input"> | |
<input class="string optional span2" data-xxx="true" id="company_profile_zipcode" name="company_profile[zipcode]" size="50" type="text" value="40549" /> | |
</div> | |
</div> | |
</form> | |
The class span2 gets added to the clearfix container div, but IMHO should only be | |
added to the input field? | |
Or is that a desired change in behaviour? Other attributes specified in input_html | |
are only added to the input-tag. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment