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.0.1.beta12 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta13 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta10 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta11 lib/avo/concerns/has_item_type.rb
avo-3.0.0.pre19 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta8 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta9 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta6 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta7 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta5 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta2 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta4 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta3 lib/avo/concerns/has_item_type.rb
avo-3.0.0.beta1 lib/avo/concerns/has_item_type.rb
avo-3.0.1.beta1 lib/avo/concerns/has_item_type.rb
avo-3.0.0.pre17 lib/avo/concerns/has_item_type.rb
avo-3.0.0.pre18 lib/avo/concerns/has_item_type.rb
avo-3.0.0.pre14 lib/avo/concerns/has_item_type.rb
avo-3.0.0.pre16 lib/avo/concerns/has_item_type.rb
avo-3.0.0.pre15 lib/avo/concerns/has_item_type.rb