Module: Spree::Admin::ProductsHelper

Defined in:
app/helpers/spree/admin/products_helper.rb

Instance Method Summary collapse

Instance Method Details

#option_types_options_for(product) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/spree/admin/products_helper.rb', line 16

def option_types_options_for(product)
  options = @option_types.map do |option_type|
    selected = product.option_types.include?(option_type)
    (:option,
                :value    => option_type.id,
                :selected => ('selected' if selected)) do
      option_type.name
    end
  end
  safe_join(options)
end

#taxon_options_for(product) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/spree/admin/products_helper.rb', line 4

def taxon_options_for(product)
  options = @taxons.map do |taxon|
    selected = product.taxons.include?(taxon)
    (:option,
                :value    => taxon.id,
                :selected => ('selected' if selected)) do
      (taxon.ancestors.pluck(:name) + [taxon.name]).join(" -> ")
    end
  end
  safe_join(options)
end