Sha256: 4d2c18e135659d933b1d6bf4c9f8be4005e056841ce0fbe8925087e4a1ec374b
Contents?: true
Size: 1.04 KB
Versions: 115
Compression:
Stored size: 1.04 KB
Contents
class Avo::TabGroupBuilder class << self def parse_block(**args, &block) Docile.dsl_eval(new(**args), &block).build end end attr_reader :items_holder delegate :tab, to: :items_holder def initialize(style: nil) @group = Avo::TabGroup.new(style: style) @items_holder = Avo::ItemsHolder.new end def field(field_name, **args, &block) parsed = Avo::Dsl::FieldParser.new(id: field_name, order_index: @items_index, **args, &block).parse field_instance = parsed.instance name = field_instance.name tab = Avo::Tab.new name: name if field_instance.has_own_panel? tab.items_holder.add_item parsed.instance tab.holds_one_field = true else # If the field is not in a panel, create one and add it panel = Avo::Panel.new name: name panel.items_holder.add_item parsed.instance # Add that panel to the bag tab.items_holder.add_item panel end @items_holder.tabs tab end # Fetch the tab def build @group.items_holder = @items_holder @group end end
Version data entries
115 entries across 115 versions & 1 rubygems