Class: Devise::Views::BootstrapFormGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
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

.i18nObject



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

.invitableObject



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_assetsObject



31
32
33
34
35
36
# File 'lib/generators/devise/views/bootstrap_form_generator.rb', line 31

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_viewsObject



23
24
25
26
27
28
29
# File 'lib/generators/devise/views/bootstrap_form_generator.rb', line 23

def copy_views
  copy_base_devise(BootstrapFormGenerator.i18n ? "i18n" : "devise")
  # The shared error message view is already internationalized.
  copy_file "views/devise/shared/_error_messages.html.erb",
            "app/views/devise/shared/_error_messages.html.erb"
  copy_invitable_devise
end