Class: SocialFramework::Generators::ViewsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/social_framework/views_generator.rb

Overview

Generator to add devise views, that are: confirmations, passwords, registrations, sessions and unlocks

This generator add all views running ‘rails generate social_framework:views’

Using the ‘-v’ option can add specific views,

Example:

To add registrations and sessions views execute ‘rails generate social_framework:views -v registrations sessions’

Instance Method Summary collapse

Instance Method Details

#add_viewsObject

Create devise directory in app/views and add devise views to app

Without ‘-v’ option generate all views, With ‘-v’ option generate specific views.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/generators/social_framework/views_generator.rb', line 23

def add_views
  directory :shared, "app/views/devise/shared"

  if options[:views]
    options[:views].each do |directory|
      directory directory.to_sym, "app/views/devise/#{directory}"
    end
  else
    directory :confirmations, "app/views/devise/confirmations"
    directory :passwords, "app/views/devise/passwords"
    directory :registrations, "app/views/devise/registrations"
    directory :sessions, "app/views/devise/sessions"
    directory :unlocks, "app/views/devise/unlocks"
    directory :mailer, "app/views/devise/mailer"
  end
end