Sha256: 0a1b52b26f33b4cd1fddfeacfe671cd4bd9db3585d1e1526695960bc33163752

Contents?: true

Size: 760 Bytes

Versions: 29

Compression:

Stored size: 760 Bytes

Contents

class Avo::TabGroup
  include Avo::Concerns::HasFields
  include Avo::Concerns::IsResourceItem

  class_attribute :item_type, default: :tab_group

  attr_reader :view
  attr_accessor :index
  attr_accessor :items_holder

  def initialize(index: 0, view: nil)
    @index = index
    @items_holder = Avo::ItemsHolder.new
    @view = view
  end

  def hydrate(view: nil)
    @view = view

    self
  end

  def visible_items
    items.map do |item|
      item.hydrate view: view
    end
    .select do |item|
      # Remove items hidden in this view
      item.visible_on? view
    end
    .select do |item|
      # Remove empty items
      !item.empty?
    end
  end

  def turbo_frame_id
    "#{Avo::TabGroup.to_s.parameterize} #{index}".parameterize
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
avo-2.13.6.pre.2 lib/avo/tab_group.rb
avo-2.13.6.pre.1 lib/avo/tab_group.rb
avo-2.13.5.pre.2 lib/avo/tab_group.rb
avo-2.13.5.pre.1 lib/avo/tab_group.rb
avo-2.13.4.pre.1 lib/avo/tab_group.rb
avo-2.13.3.pre.4 lib/avo/tab_group.rb
avo-2.13.3.pre.3 lib/avo/tab_group.rb
avo-2.13.3.pre.2 lib/avo/tab_group.rb
avo-2.13.3.pre.1 lib/avo/tab_group.rb
avo-2.13.2.pre.2 lib/avo/tab_group.rb
avo-2.13.2.pre.1 lib/avo/tab_group.rb
avo-2.13.1 lib/avo/tab_group.rb
avo-2.13.0 lib/avo/tab_group.rb
avo-2.12.1.pre.1 lib/avo/tab_group.rb
avo-2.12.0 lib/avo/tab_group.rb
avo-2.11.3.pre.3 lib/avo/tab_group.rb
avo-2.11.3.pre.2 lib/avo/tab_group.rb
avo-2.11.3.pre.1 lib/avo/tab_group.rb
avo-2.11.2.pre.3 lib/avo/tab_group.rb
avo-2.11.2.pre.2 lib/avo/tab_group.rb