Class: ActivityNotification::Generators::ViewsGenerator

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

Overview

View generator to copy customizable view files to rails application. Include this module in your generator to generate ActivityNotification views. ‘copy_views` is the main method and by default copies all views of ActivityNotification.

Examples:

Run view generator to create customizable default views for all targets

rails generate activity_notification:views

Run view generator to create views for users as the specified target

rails generate activity_notification:views users

Run view generator to create only notification views

rails generate activity_notification:views -v notifications

Run view generator to create only notification email views

rails generate activity_notification:views -v mailer

Constant Summary collapse

VIEWS =
[:notifications, :mailer, :subscriptions, :optional_targets].freeze

Instance Method Summary collapse

Instance Method Details

#copy_viewsObject

Copies view files in application directory



29
30
31
32
33
34
# File 'lib/generators/activity_notification/views_generator.rb', line 29

def copy_views
  target_views = options[:views] || VIEWS
  target_views.each do |directory|
    view_directory directory.to_sym
  end
end