Class: Avo::BaseResourceTool

Inherits:
Object
  • Object
show all
Includes:
Concerns::HasItemType, Concerns::Hydration, Concerns::IsResourceItem, Concerns::IsVisible, Concerns::VisibleInDifferentViews
Defined in:
lib/avo/base_resource_tool.rb

Instance Attribute Summary collapse

Attributes included from Concerns::VisibleInDifferentViews

#show_on_edit, #show_on_index, #show_on_new, #show_on_preview, #show_on_show

Attributes included from Concerns::IsVisible

#visible

Instance Method Summary collapse

Methods included from Concerns::Hydration

#hydrate

Methods included from Concerns::VisibleInDifferentViews

#except_on, #hide_on, #initialize_views, #only_on, #post_initialize, #show_on, #show_on_create, #show_on_update, #visible_in_view?

Methods included from Concerns::IsVisible

#visible?

Methods included from Concerns::HasItemType

#is_field?, #is_heading?, #is_main_panel?, #is_panel?, #is_row?, #is_sidebar?, #is_tab?, #is_tab_group?, #is_tool?

Methods included from Concerns::IsResourceItem

#visible?

Constructor Details

#initialize(**args) ⇒ BaseResourceTool

Returns a new instance of BaseResourceTool.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/avo/base_resource_tool.rb', line 18

def initialize(**args)
  # Set the visibility
  only_on Avo.configuration.resource_default_view

  @args = args
  @parent = args[:parent]
  @resource = args[:parent]
  @view = args[:view]

  post_initialize if respond_to?(:post_initialize)
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



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

def params
  @params
end

#parentObject

Returns the value of attribute parent.



14
15
16
# File 'lib/avo/base_resource_tool.rb', line 14

def parent
  @parent
end

#resourceObject

Returns the value of attribute resource.



15
16
17
# File 'lib/avo/base_resource_tool.rb', line 15

def resource
  @resource
end

#viewObject

Returns the value of attribute view.



16
17
18
# File 'lib/avo/base_resource_tool.rb', line 16

def view
  @view
end

Instance Method Details

#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?

  self.class.to_s.underscore
end