Sha256: 9f76b4fc2be102e2ec1743c1b598943e173412a7dace5c3b5f0ce7e5730214d3

Contents?: true

Size: 791 Bytes

Versions: 49

Compression:

Stored size: 791 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
      extend ActiveSupport::Concern

      included do
        class_attribute :item_type, default: nil
      end

      def is_field?
        self.class.item_type == :field
      end

      def is_panel?
        self.class.item_type == :panel || self.class.item_type == :main_panel
      end

      def is_main_panel?
        self.class.item_type == :main_panel
      end

      def is_tool?
        self.class.item_type == :tool
      end

      def is_tab?
        self.class.item_type == :tab
      end

      def is_tab_group?
        self.class.item_type == :tab_group
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
avo-2.16.1.pre.1.nativefields lib/avo/concerns/is_resource_item.rb
avo-2.16.0 lib/avo/concerns/is_resource_item.rb
avo-2.15.3 lib/avo/concerns/is_resource_item.rb
avo-2.15.3.pre.1.data.attrs.to.sidebar.items lib/avo/concerns/is_resource_item.rb
avo-2.15.2 lib/avo/concerns/is_resource_item.rb
avo-2.15.2.pre.1 lib/avo/concerns/is_resource_item.rb
avo-2.15.1 lib/avo/concerns/is_resource_item.rb
avo-2.15.0 lib/avo/concerns/is_resource_item.rb
avo-2.14.3.pre.7.polytranslations1 lib/avo/concerns/is_resource_item.rb
avo-2.14.3.pre.6.nosprockets lib/avo/concerns/is_resource_item.rb
avo-2.14.3.pre.5.nosprockets lib/avo/concerns/is_resource_item.rb
avo-2.14.3.pre.4.tosqlfix lib/avo/concerns/is_resource_item.rb
avo-2.14.3.pre.3.jsbundling lib/avo/concerns/is_resource_item.rb
avo-2.14.3.pre.2.tailwindcss lib/avo/concerns/is_resource_item.rb
avo-2.14.3.pre.1.branding lib/avo/concerns/is_resource_item.rb
avo-2.14.2 lib/avo/concerns/is_resource_item.rb
avo-2.14.2.pre.1 lib/avo/concerns/is_resource_item.rb
avo-2.14.1 lib/avo/concerns/is_resource_item.rb
avo-2.14.1.pre.1 lib/avo/concerns/is_resource_item.rb
avo-2.14.0 lib/avo/concerns/is_resource_item.rb