Sha256: d0ed984d8669282eb19d021da3ff9a7fcbce0401cc40c0498b2065240cea346a

Contents?: true

Size: 867 Bytes

Versions: 4

Compression:

Stored size: 867 Bytes

Contents

module Spree
  module Admin
    module ProductsHelper
      def taxon_options_for(product)
        options = @taxons.map do |taxon|
          selected = product.taxons.include?(taxon)
          content_tag(:option,
                      :value    => taxon.id,
                      :selected => ('selected' if selected)) do
            (taxon.ancestors.map(&:name) + [taxon.name]).join(" -> ")
          end
        end.join("").html_safe
      end

      def option_types_options_for(product)
        options = @option_types.map do |option_type|
          selected = product.option_types.include?(option_type)
          content_tag(:option,
                      :value    => option_type.id,
                      :selected => ('selected' if selected)) do
            option_type.presentation
          end
        end.join("").html_safe
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_core-1.2.2 app/helpers/spree/admin/products_helper.rb
spree_core-1.2.0 app/helpers/spree/admin/products_helper.rb
spree_core-1.2.0.rc2 app/helpers/spree/admin/products_helper.rb
spree_core-1.2.0.rc1 app/helpers/spree/admin/products_helper.rb