Sha256: 16b3d07bf4e2022be5c8c05fafddfae6869def3a639a1f78c637ddca613ba917

Contents?: true

Size: 1.07 KB

Versions: 118

Compression:

Stored size: 1.07 KB

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 HasItemType
      def is_field?
        self.class.ancestors.include?(Avo::Fields::BaseField)
      end

      def is_heading?
        self.class.ancestors.include?(Avo::Fields::HeadingField)
      end

      def is_panel?
        self.class.ancestors.include?(Avo::Resources::Items::Panel)
      end

      def is_main_panel?
        self.class.ancestors.include?(Avo::Resources::Items::MainPanel)
      end

      def is_tool?
        self.class.ancestors.include?(Avo::BaseResourceTool)
      end

      def is_tab?
        self.class.ancestors.include?(Avo::Resources::Items::Tab)
      end

      def is_tab_group?
        self.class.ancestors.include?(Avo::Resources::Items::TabGroup)
      end

      def is_sidebar?
        self.class.ancestors.include?(Avo::Resources::Items::Sidebar)
      end

      def is_row?
        self.class.respond_to?(:item_type) && self.class.item_type == :row
      end
    end
  end
end

Version data entries

118 entries across 118 versions & 1 rubygems

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