Module: Avo::Concerns::IsResourceItem

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Hydration

#hydrate

Instance Attribute Details

#resourceObject

These attributes are required to be hydrated in order to properly find the visible_items



8
9
10
# File 'lib/avo/concerns/is_resource_item.rb', line 8

def resource
  @resource
end

#viewObject

Returns the value of attribute view.



9
10
11
# File 'lib/avo/concerns/is_resource_item.rb', line 9

def view
  @view
end

Instance Method Details

#visible?Boolean

Returns the final state of if an item is visible or not For items that have children it checks to see if it contains any visible children.

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
# File 'lib/avo/concerns/is_resource_item.rb', line 13

def visible?
  # For items that may contains other items like tabs and panels we should also check
  # if any on their children have visible items.
  if self.class.ancestors.include?(Avo::Concerns::HasItems)
    return false unless visible_items.any?
  end

  super
end