Skip to content

Commit

Permalink
Merge pull request #1738 from mhw/bootstrap-5
Browse files Browse the repository at this point in the history
Update install generator for Bootstrap 5
  • Loading branch information
nashby authored Mar 7, 2022
2 parents 3238067 + e268f95 commit 1535f32
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 194 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ Run the generator:
rails generate simple_form:install
```

### Bootstrap
### Bootstrap 5

**Simple Form** can be easily integrated to the [Bootstrap](http://getbootstrap.com/).
To do that you have to use the `bootstrap` option in the install generator, like this:
**Simple Form** can be easily integrated with [Bootstrap 5](http://getbootstrap.com/).
Use the `bootstrap` option in the install generator, like this:

```console
rails generate simple_form:install --bootstrap
```

This will add an initializer that configures **Simple Form** wrappers for
Bootstrap 5's [form controls](https://getbootstrap.com/docs/5.0/forms/overview/).
You have to be sure that you added a copy of the [Bootstrap](http://getbootstrap.com/)
assets on your application.

Expand Down
4 changes: 2 additions & 2 deletions lib/generators/simple_form/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class InstallGenerator < Rails::Generators::Base
desc "Copy SimpleForm default files"
source_root File.expand_path('../templates', __FILE__)
class_option :template_engine, desc: 'Template engine to be invoked (erb, haml or slim).'
class_option :bootstrap, type: :boolean, desc: 'Add the Bootstrap wrappers to the SimpleForm initializer.'
class_option :bootstrap, type: :boolean, desc: 'Add the Bootstrap 5 wrappers to the SimpleForm initializer.'
class_option :foundation, type: :boolean, desc: 'Add the Zurb Foundation 5 wrappers to the SimpleForm initializer.'

def info_bootstrap
return if options.bootstrap? || options.foundation?
puts "SimpleForm 3 supports Bootstrap and Zurb Foundation 5. If you want "\
puts "SimpleForm supports Bootstrap 5 and Zurb Foundation 5. If you want "\
"a configuration that is compatible with one of these frameworks, then please " \
"re-run this generator with --bootstrap or --foundation as an option."
end
Expand Down
Loading

0 comments on commit 1535f32

Please sign in to comment.