Sha256: 572324fb20b9b65d01d3b103bf2387994a12c0d7cf68986bab8d97653fd2892a

Contents?: true

Size: 931 Bytes

Versions: 25

Compression:

Stored size: 931 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

      def is_sidebar?
        self.class.item_type == :sidebar
      end

      def is_row?
        self.class.item_type == :row
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
avo-2.53.0 lib/avo/concerns/is_resource_item.rb
avo-2.52.0 lib/avo/concerns/is_resource_item.rb
avo-2.49.0 lib/avo/concerns/is_resource_item.rb
avo-2.48.0 lib/avo/concerns/is_resource_item.rb
avo-2.47.0 lib/avo/concerns/is_resource_item.rb
avo-2.46.0 lib/avo/concerns/is_resource_item.rb
avo-2.45.0 lib/avo/concerns/is_resource_item.rb
avo-2.44.0 lib/avo/concerns/is_resource_item.rb
avo-2.43.0 lib/avo/concerns/is_resource_item.rb
avo-2.42.2 lib/avo/concerns/is_resource_item.rb
avo-2.42.1 lib/avo/concerns/is_resource_item.rb
avo-2.42.0 lib/avo/concerns/is_resource_item.rb
avo-2.41.0 lib/avo/concerns/is_resource_item.rb
avo-2.40.0 lib/avo/concerns/is_resource_item.rb
avo-2.39.0 lib/avo/concerns/is_resource_item.rb
avo-2.38.0 lib/avo/concerns/is_resource_item.rb
avo-2.37.2 lib/avo/concerns/is_resource_item.rb
avo-2.37.1 lib/avo/concerns/is_resource_item.rb
avo-2.37.0 lib/avo/concerns/is_resource_item.rb
avo-2.36.3 lib/avo/concerns/is_resource_item.rb