lib/avo/resources/items/holder.rb in avo-3.0.0.beta1 vs lib/avo/resources/items/holder.rb in avo-3.0.0.pre1

- old
+ new

@@ -20,33 +20,25 @@ # @todo: Make sure this warning is still active return add_invalid_field({ name: field_name, as: as, # resource: resource_class.name, - message: "There's an invalid field configuration for this resource. <br/> <code class='px-1 py-px rounded bg-red-600'>field :#{field_name}, as: :#{as}</code>" + message: "There's an invalid field configuration for this resource. <br/> <code class='px-1 py-px rounded bg-red-600'>field :#{field_name}, as: #{as}</code>" }) end add_item field_parser.instance end - def tabs(tab = nil, **kwargs, &block) - if tab.present? - add_item tab - else - add_item Avo::Resources::Items::TabGroup::Builder.parse_block(**kwargs, &block) - end + def tabs(instance) + add_item instance end def tab(name, **args, &block) add_item Avo::Resources::Items::Tab::Builder.parse_block(name: name, **args, &block) end - def row(**args, &block) - add_item Avo::Resources::Items::Row::Builder.parse_block(**args, &block) - end - def tool(klass, **args) instance = klass.new(**args) add_item instance end @@ -60,11 +52,11 @@ field = Avo::Fields::HeadingField.new(body, **args) add_item field end - def sidebar(**args, &block) - add_item Avo::Resources::Items::Sidebar::Builder.parse_block(**args, &block) + def sidebar(instance) + add_item instance end def add_item(instance) @items << instance