Class: Devise::Views::BootstrapFormGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Devise::Views::BootstrapFormGenerator
- Defined in:
- lib/generators/devise/views/bootstrap_form_generator.rb
Overview
Generates Devise and Devise Invitable forms using ‘bootstrap_form` helpers.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.i18n ⇒ Object
14 15 16 |
# File 'lib/generators/devise/views/bootstrap_form_generator.rb', line 14 def i18n Object.const_get(:DeviseI18n).is_a?(Module) rescue false # rubocop:disable Style/RescueModifier end |
.invitable ⇒ Object
10 11 12 |
# File 'lib/generators/devise/views/bootstrap_form_generator.rb', line 10 def invitable Object.const_get(:DeviseInvitable).is_a?(Module) rescue false # rubocop:disable Style/RescueModifier end |
Instance Method Details
#copy_assets ⇒ Object
36 37 38 39 40 41 |
# File 'lib/generators/devise/views/bootstrap_form_generator.rb', line 36 def copy_assets directory "assets/stylesheets", "app/assets/stylesheets" append_to_file "app/assets/stylesheets/application.scss" do '@import "devise_bootstrap_form";' end end |
#copy_views ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/devise/views/bootstrap_form_generator.rb', line 23 def copy_views %w[confirmations passwords registrations sessions shared unlocks].each do |dir| directory File.join("views/#{BootstrapFormGenerator.i18n ? 'i18n' : 'devise'}", dir), "app/views/devise/#{dir}" end if BootstrapFormGenerator.invitable # rubocop:disable Style/GuardClause %w[invitations mailer].each do |dir| directory File.join("views/devise", dir), "app/views/devise/#{dir}" end end end |