From 612c0067cf0313cd02c33c4870413a15e96a261a Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 14 Feb 2012 23:39:47 -0200 Subject: [PATCH] Change default generator classes to .form-inputs and .form-actions Makes it easier to integrate with bootstrap. Related to #424 --- CHANGELOG.md | 2 ++ lib/generators/simple_form/templates/_form.html.erb | 4 ++-- lib/generators/simple_form/templates/_form.html.haml | 4 ++-- lib/generators/simple_form/templates/_form.html.slim | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 226e7788..945d65b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/generators/simple_form/templates/_form.html.erb b/lib/generators/simple_form/templates/_form.html.erb index 24a17689..201a069e 100644 --- a/lib/generators/simple_form/templates/_form.html.erb +++ b/lib/generators/simple_form/templates/_form.html.erb @@ -1,13 +1,13 @@ <%%= simple_form_for(@<%= singular_table_name %>) do |f| %> <%%= f.error_notification %> -
+
<%- attributes.each do |attribute| -%> <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> <%- end -%>
-
+
<%%= f.button :submit %>
<%% end %> diff --git a/lib/generators/simple_form/templates/_form.html.haml b/lib/generators/simple_form/templates/_form.html.haml index bfe7fe69..ac3aa7bc 100644 --- a/lib/generators/simple_form/templates/_form.html.haml +++ b/lib/generators/simple_form/templates/_form.html.haml @@ -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 diff --git a/lib/generators/simple_form/templates/_form.html.slim b/lib/generators/simple_form/templates/_form.html.slim index ac0f19a9..a2ff775a 100644 --- a/lib/generators/simple_form/templates/_form.html.slim +++ b/lib/generators/simple_form/templates/_form.html.slim @@ -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