Skip to content

Commit

Permalink
Change default generator classes to .form-inputs and .form-actions
Browse files Browse the repository at this point in the history
Makes it easier to integrate with bootstrap. Related to #424
  • Loading branch information
carlosantoniodasilva committed Feb 15, 2012
1 parent 04f70e8 commit 612c006
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
and is backported inside SimpleForm builder extensions.
More info in [#215](https://github.com/plataformatec/simple_form/issues/215)
* Add `item_wrapper_class` configuration option for collection radio buttons / check boxes inputs.
* Change default generator templates to use .form-inputs and .form-actions classes in wrapper divs.
(the latter is the default in bootstrap, so this makes it easier to integrate).

### deprecation
* Deprecate part of the old configuration API in favor of the wrapper API which allows you to customize your inputs
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/simple_form/templates/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
<%%= f.error_notification %>

<div class="inputs">
<div class="form-inputs">
<%- attributes.each do |attribute| -%>
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
<%- end -%>
</div>

<div class="actions">
<div class="form-actions">
<%%= f.button :submit %>
</div>
<%% end %>
4 changes: 2 additions & 2 deletions lib/generators/simple_form/templates/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
= simple_form_for(@<%= singular_table_name %>) do |f|
= f.error_notification

.inputs
.form-inputs
<%- attributes.each do |attribute| -%>
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>

.actions
.form-actions
= f.button :submit
4 changes: 2 additions & 2 deletions lib/generators/simple_form/templates/_form.html.slim
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
= simple_form_for(@<%= singular_table_name %>) do |f|
= f.error_notification

.inputs
.form-inputs
<%- attributes.each do |attribute| -%>
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>

.actions
.form-actions
= f.button :submit

0 comments on commit 612c006

Please sign in to comment.