Sha256: 34b3052846442ed52d66824448ddc06aaa41382f10620251c745feeed53e82ab

Contents?: true

Size: 679 Bytes

Versions: 5

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true

class SolidusAdmin::Products::Show::Component < SolidusAdmin::BaseComponent
  include SolidusAdmin::Layout::PageHelpers

  def initialize(product:)
    @product = product
  end

  def form_id
    @form_id ||= "#{stimulus_id}--form-#{@product.id}"
  end

  private

  def taxon_options
    @taxon_options ||= Spree::Taxon.order(:lft).pluck(:name, :id, :lft, :depth).map do
      name, id, _lft, depth = _1
      ["#{'    ' * depth} → #{name}", id]
    end
  end

  def option_type_options
    @option_type_options ||= Spree::OptionType.order(:presentation).pluck(:presentation, :name, :id).map do
      ["#{_1} (#{_2})", _3]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 app/components/solidus_admin/products/show/component.rb
solidus_admin-0.3.1 app/components/solidus_admin/products/show/component.rb
solidus_admin-0.3.0 app/components/solidus_admin/products/show/component.rb
solidus_admin-0.2.0 app/components/solidus_admin/products/show/component.rb
solidus_admin-0.1.0 app/components/solidus_admin/products/show/component.rb