Sha256: 6d6fff37affe99403a0f237d81712250442dcd0cde68d6981890b4e06a09a343

Contents?: true

Size: 1.24 KB

Versions: 44

Compression:

Stored size: 1.24 KB

Contents

class Avo::Resources::Items::ItemGroup
  prepend Avo::Concerns::IsResourceItem

  include Avo::Concerns::HasItems
  include Avo::Concerns::HasItemType
  include Avo::Concerns::VisibleItems
  include Avo::Concerns::VisibleInDifferentViews
  include Avo::Concerns::IsVisible

  attr_reader :name
  attr_reader :description

  delegate :items, :add_item, to: :items_holder

  def initialize(name: nil, description: nil, view: nil, **args)
    @name = name
    @view = Avo::ViewInquirer.new view
    @description = description
    @items_holder = Avo::Resources::Items::Holder.new
    @args = args
    @visible = args[:visible]

    post_initialize if respond_to?(:post_initialize)
  end

  class Builder
    include Avo::Concerns::BorrowItemsHolder

    delegate :heading, to: :items_holder
    delegate :field, to: :items_holder
    delegate :row, to: :items_holder
    delegate :items, to: :items_holder
    delegate :sidebar, to: :items_holder

    def initialize(parent:, name: nil, **args)
      @panel = Avo::Resources::Items::Panel.new(name: name, **args)
      @items_holder = Avo::Resources::Items::Holder.new(from: self.class, parent: parent)
    end

    # Fetch the tab
    def build
      @panel.items_holder = @items_holder
      @panel
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
avo-3.13.7 lib/avo/resources/items/item_group.rb
avo-3.13.6 lib/avo/resources/items/item_group.rb
avo-3.13.5 lib/avo/resources/items/item_group.rb
avo-3.13.4 lib/avo/resources/items/item_group.rb
avo-3.13.3 lib/avo/resources/items/item_group.rb
avo-3.13.2 lib/avo/resources/items/item_group.rb
avo-3.13.1 lib/avo/resources/items/item_group.rb
avo-3.13.0 lib/avo/resources/items/item_group.rb
avo-3.12.0 lib/avo/resources/items/item_group.rb
avo-3.11.10 lib/avo/resources/items/item_group.rb
avo-3.11.9 lib/avo/resources/items/item_group.rb
avo-3.11.8 lib/avo/resources/items/item_group.rb
avo-3.11.7 lib/avo/resources/items/item_group.rb
avo-3.11.6 lib/avo/resources/items/item_group.rb
avo-3.11.5 lib/avo/resources/items/item_group.rb
avo-3.11.4 lib/avo/resources/items/item_group.rb
avo-3.11.3 lib/avo/resources/items/item_group.rb
avo-3.11.2 lib/avo/resources/items/item_group.rb
avo-3.11.1 lib/avo/resources/items/item_group.rb
avo-3.11.0 lib/avo/resources/items/item_group.rb