Sha256: a48d8ced7db0491ec73e5e66f1b694ec558d0be8e1b296bfda9d63399c47356a
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require "rails/generators" module Devise module Views # Generates Devise and Devise Invitable forms using `bootstrap_form` helpers. class BootstrapFormGenerator < Rails::Generators::Base class << self def invitable Object.const_get(:DeviseInvitable).is_a?(Module) rescue false # rubocop:disable Style/RescueModifier end end desc "Copies views styled for Bootstrap 4 via the `bootstrap_form` gem" source_root File.expand_path("../../../../app", __dir__) def copy_views %w[confirmations passwords registrations sessions shared unlocks].each do |dir| directory File.join("views/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 def copy_assets directory "assets/stylesheets", "app/assets/stylesheets" append_to_file "app/assets/stylesheets/application.scss" do '@import "devise_bootstrap_form";' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise-bootstrap-form-0.1.0 | lib/generators/devise/views/bootstrap_form_generator.rb |