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)
  @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

#show_rebuild_vat_checkbox?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/helpers/spree/admin/products_helper.rb', line 28

def show_rebuild_vat_checkbox?
  Spree::TaxRate.included_in_price.exists?
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