Sha256: 0aa8f6114841fcafddcfa58b863d193af7e3d4ef6bc4c7121abd7b3dc7eab956

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

class SolidusAdmin::Products::Show::Component < SolidusAdmin::BaseComponent
  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

2 entries across 2 versions & 1 rubygems

Version Path
solidus_admin-0.0.2 app/components/solidus_admin/products/show/component.rb
solidus_admin-0.0.1 app/components/solidus_admin/products/show/component.rb