A Rails generator for creating bootstrap styled views (Erb, Slim, and HAML).
MIT License
This gem is used for generating Bootstrap based scaffold views for your Rails application. They can be Erb, Slim, or HAML. You can include pagination (using Pagy), simple_form (for the form components), and if you'd like you can utilize the meta-tags gems to all dynamic page titles when switching between your view components.
Add this line to your application's Gemfile:
gem 'bootstrap_views_generator', group: :development
# Now make sure you have the bootstrap gem installed in your Gemfile
gem 'bootstrap', '~> 4.3'
# And ensure you have bootstrap included in your application.scss
@import 'bootstrap';
And then execute:
$ bundle
Or install it yourself as:
$ gem install bootstrap_views_generator
Usage:
rails g bootstrap:install [options]
Options:
Options:
-t, [--template-engine=TEMPLATE_ENGINE] # Indicates when to generate using a designated template engine (erb, slim, haml)
# Default: erb
--simpleform # Indicates if simple_form is to be used to generate the forms
# Default: false
--pagination # Specify if you want to add pagination to the index pages
# Defaults: false (requires Pagy to use pagination)
--metatags # If you want the pages titles to use the metatags gem function for the page title
# Default: false
--layout # Over-write your application layout file with a bootstrap based layout
# Default: false
--devise # If you want to generate bootstrap based devise views
# Default: false
--skip_javascript # If you want to skip adding javascript_include_tag || javascript_pack_tag to the layouts
# Default: false
--skip_turbolinks # Do you want to skip associating turbolinks with the assets and views
# Default: false
Supported Template Engines
HAML
Make sure you have haml added to your your Gemfile
gem 'haml-rails'
# generate haml views
rails g bootstrap:install --template_engine=haml
Slim Make sure you have Slim added to your Gemfile
gem 'slim-rails'
# generate Slim views
rails g bootstrap:install --template_engine=slim
Ensure you have Pagy gem installed
# Gemfile
gem 'pagy'
# Make sure you have the bootstrap pagy helper included
# config/initializers/pagy.rb
require 'pagy/extras/bootstrap'
Ensure you have the meta-tags gem installed
gem 'meta-tags'
Generate bootstrap views with pagination enabled
rails g bootstrap:install --pagination
Generate bootstrap views with slim and using simple_form
rails g bootstrap:install --template_engine=slim --simpleform
Generate bootstrap scaffolds, devise views, while using simpleform, metatags, and slim template engine.
rails g bootstrap:install --devise --simpleform --metatags --template_engine=slim
rails generate simple_form:install --bootstrap