Class: Avo::BaseResourceTool

Inherits:
Object
  • Object
show all
Includes:
Concerns::IsResourceItem, Fields::FieldExtensions::VisibleInDifferentViews
Defined in:
lib/avo/base_resource_tool.rb

Instance Attribute Summary collapse

Attributes included from Fields::FieldExtensions::VisibleInDifferentViews

#show_on_edit, #show_on_index, #show_on_new, #show_on_show

Instance Method Summary collapse

Methods included from Fields::FieldExtensions::VisibleInDifferentViews

#except_on, #hide_on, #only_on, #show_on, #show_on_create, #show_on_update, #visible_on?

Methods included from Concerns::IsResourceItem

#is_field?, #is_main_panel?, #is_panel?, #is_tab?, #is_tab_group?, #is_tool?

Constructor Details

#initialize(**args) ⇒ BaseResourceTool

Returns a new instance of BaseResourceTool.



14
15
16
17
18
19
20
21
22
# File 'lib/avo/base_resource_tool.rb', line 14

def initialize(**args)
  # Set the visibility
  show_on :show

  show_on args[:show_on] if args[:show_on].present?
  hide_on args[:hide_on] if args[:hide_on].present?
  only_on args[:only_on] if args[:only_on].present?
  except_on args[:except_on] if args[:except_on].present?
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



10
11
12
# File 'lib/avo/base_resource_tool.rb', line 10

def params
  @params
end

#resourceObject

Returns the value of attribute resource.



11
12
13
# File 'lib/avo/base_resource_tool.rb', line 11

def resource
  @resource
end

#viewObject

Returns the value of attribute view.



12
13
14
# File 'lib/avo/base_resource_tool.rb', line 12

def view
  @view
end

Instance Method Details

#hydrate(view: nil) ⇒ Object



24
25
26
27
28
# File 'lib/avo/base_resource_tool.rb', line 24

def hydrate(view: nil)
  @view = view if view.present?

  self
end

#partialObject



30
31
32
33
34
# File 'lib/avo/base_resource_tool.rb', line 30

def partial
  return self.class.partial if self.class.partial.present?

  "avo/resource_tools/#{self.class.to_s.underscore}"
end