Sha256: c3758a36e1b32bedd39676a12fe46b7697a5b7a1da56e96cb782c8824efa9d3c

Contents?: true

Size: 1.06 KB

Versions: 26

Compression:

Stored size: 1.06 KB

Contents

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

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

  delegate :items, :add_item, to: :items_holder

  attr_reader :name

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

    post_initialize if respond_to?(:post_initialize)
  end

  class Builder
    class << self
      def parse_block(**args, &block)
        Docile.dsl_eval(new(**args), &block).build
      end
    end

    attr_reader :items_holder

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

    def initialize(name: nil, **args)
      @sidebar = Avo::Resources::Items::Sidebar.new(**args)
      @items_holder = Avo::Resources::Items::Holder.new
    end

    # Fetch the sidebar
    def build
      @sidebar.items_holder = @items_holder
      @sidebar
    end
  end

end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
avo-3.0.0.pre5 lib/avo/resources/items/sidebar.rb
avo-3.0.0.pre6 lib/avo/resources/items/sidebar.rb
avo-3.0.0.pre4 lib/avo/resources/items/sidebar.rb
avo-3.0.0.pre3 lib/avo/resources/items/sidebar.rb
avo-3.0.0.pre2 lib/avo/resources/items/sidebar.rb
avo-3.0.0.pre1 lib/avo/resources/items/sidebar.rb