Sha256: 3abd666c849c74c5edc1fbe4adbdd0ddece6f089323392881fedb9290d52ddc0

Contents?: true

Size: 859 Bytes

Versions: 8

Compression:

Stored size: 859 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.name
          end
        end.join("").html_safe
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
spree_core-1.2.5 app/helpers/spree/admin/products_helper.rb
spree_core-1.2.4 app/helpers/spree/admin/products_helper.rb
spree_core-1.2.3 app/helpers/spree/admin/products_helper.rb
spree_core-1.3.1 app/helpers/spree/admin/products_helper.rb
spree_core-1.3.0 app/helpers/spree/admin/products_helper.rb
spree_core-1.3.0.rc2 app/helpers/spree/admin/products_helper.rb
dup_spree_core-1.3.0.rc1 app/helpers/spree/admin/products_helper.rb
spree_core-1.3.0.rc1 app/helpers/spree/admin/products_helper.rb