Class: Generators::Avo::ResourceGenerator

Inherits:
NamedBaseGenerator
  • Object
show all
Includes:
Concerns::OverrideController, Concerns::ParentController
Defined in:
lib/generators/avo/resource_generator.rb

Constant Summary collapse

ICON_MAP =
{
  user: "tabler/outline/users",
  customer: "tabler/outline/user",
  transaction: "tabler/outline/credit-card-pay",
  post: "tabler/outline/ballpen",
  comment: "tabler/outline/message",
  product: "tabler/outline/package",
  order: "tabler/outline/shopping-cart",
  category: "tabler/outline/folder",
  tag: "tabler/outline/tag",
  project: "tabler/outline/building-store",
  team: "tabler/outline/users-group",
  company: "tabler/outline/building",
  invoice: "tabler/outline/file-invoice",
  payment: "tabler/outline/cash",
  article: "tabler/outline/article",
  event: "tabler/outline/calendar-event",
  notification: "tabler/outline/bell",
  message: "tabler/outline/mail",
  setting: "heroicons/outline/cog",
  report: "tabler/filled/chart-pie-4",
  task: "tabler/outline/checklist",
  review: "tabler/outline/star",
  photo: "tabler/outline/photo",
  image: "tabler/outline/photo",
  video: "tabler/outline/video",
  file: "tabler/outline/file",
  document: "tabler/outline/file-text",
  role: "tabler/outline/shield",
  permission: "tabler/outline/lock",
  subscription: "tabler/outline/credit-card",
  plan: "tabler/outline/list",
  address: "tabler/outline/map-pin",
  location: "tabler/outline/map-pin",
  country: "tabler/outline/world-map",
  city: "tabler/outline/building-community",
  account: "tabler/outline/user-circle"
}.freeze

Instance Method Summary collapse

Methods included from Concerns::OverrideController

#controllers_list, #override_controller?

Methods included from Concerns::ParentController

#parent_controller

Methods inherited from NamedBaseGenerator

#initialize

Constructor Details

This class inherits a constructor from Generators::Avo::NamedBaseGenerator

Instance Method Details

#createObject



69
70
71
72
73
74
# File 'lib/generators/avo/resource_generator.rb', line 69

def create
  return if override_controller?

  template "resource/resource.tt", "app/avo/resources/#{file_path}.rb"
  invoke "avo:controller", [class_name], options
end