Sha256: 1dfeb9beeb19e99281765e1621199d2156a6d4d87a4428f8664af7d76401ac93

Contents?: true

Size: 1.09 KB

Versions: 52

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

class Avo::Items::PanelComponent < Avo::ResourceComponent
  include Avo::ApplicationHelper

  def initialize(form:, item:, is_main_panel:, resource:, view:, actions: nil, index: nil, parent_component: nil, parent_record: nil, parent_resource: nil, reflection: nil)
    @actions = actions
    @form = form
    @index = index
    @is_main_panel = is_main_panel
    @item = item
    @parent_component = parent_component
    @parent_record = parent_record
    @parent_resource = parent_resource
    @reflection = reflection
    @resource = resource
    @view = view
  end

  delegate :controls,
    :title,
    :back_path,
    :edit_path,
    :can_see_the_destroy_button?,
    :can_see_the_save_button?,
    :view_for,
    :display_breadcrumbs,
    to: :@parent_component

  def args
    if @is_main_panel
      {
        name: title,
        description: @resource.description,
        display_breadcrumbs: display_breadcrumbs,
        index: 0,
        data: {panel_id: "main"}
      }
    else
      {name: @item.name, description: @item.description, index: @index}
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
avo-3.1.4 app/components/avo/items/panel_component.rb
avo-3.1.3 app/components/avo/items/panel_component.rb
avo-3.1.2 app/components/avo/items/panel_component.rb
avo-3.1.1 app/components/avo/items/panel_component.rb
avo-3.1.0 app/components/avo/items/panel_component.rb
avo-3.0.8 app/components/avo/items/panel_component.rb
avo-3.0.7 app/components/avo/items/panel_component.rb
avo-3.0.6 app/components/avo/items/panel_component.rb
avo-3.0.5 app/components/avo/items/panel_component.rb
avo-3.0.4 app/components/avo/items/panel_component.rb
avo-3.0.3 app/components/avo/items/panel_component.rb
avo-3.0.2 app/components/avo/items/panel_component.rb