Sha256: e3230dc3050b46578d245f1d49ee583cfa852cd22e86e0d1485cbdb3a2c545c2

Contents?: true

Size: 873 Bytes

Versions: 87

Compression:

Stored size: 873 Bytes

Contents

# This concern helps us figure out what kind of items (field, tool, tab_group, or panel) have been passed to the resource or action.
module Avo
  module Concerns
    module IsResourceItem
      include Avo::Concerns::Hydration

      # These attributes are required to be hydrated in order to properly find the visible_items
      attr_accessor :resource
      attr_accessor :view

      # 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.
      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
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
avo-3.14.3 lib/avo/concerns/is_resource_item.rb
avo-3.14.2 lib/avo/concerns/is_resource_item.rb
avo-3.14.1 lib/avo/concerns/is_resource_item.rb
avo-3.14.0 lib/avo/concerns/is_resource_item.rb
avo-3.13.7 lib/avo/concerns/is_resource_item.rb
avo-3.13.6 lib/avo/concerns/is_resource_item.rb
avo-3.13.5 lib/avo/concerns/is_resource_item.rb
avo-3.13.4 lib/avo/concerns/is_resource_item.rb
avo-3.13.3 lib/avo/concerns/is_resource_item.rb
avo-3.13.2 lib/avo/concerns/is_resource_item.rb
avo-3.13.1 lib/avo/concerns/is_resource_item.rb
avo-3.13.0 lib/avo/concerns/is_resource_item.rb
avo-3.12.0 lib/avo/concerns/is_resource_item.rb
avo-3.11.10 lib/avo/concerns/is_resource_item.rb
avo-3.11.9 lib/avo/concerns/is_resource_item.rb
avo-3.11.8 lib/avo/concerns/is_resource_item.rb
avo-3.11.7 lib/avo/concerns/is_resource_item.rb
avo-3.11.6 lib/avo/concerns/is_resource_item.rb
avo-3.11.5 lib/avo/concerns/is_resource_item.rb
avo-3.11.4 lib/avo/concerns/is_resource_item.rb