Sha256: cd0540416ecde1da8e9937ce9eaaf38b4036be4f0aa6a0a01a4ff94a3723329e

Contents?: true

Size: 973 Bytes

Versions: 15

Compression:

Stored size: 973 Bytes

Contents

module Spree
  module Admin
    class ProductPropertiesController < ResourceController
      belongs_to 'spree/product', :find_by => :slug
      before_action :find_properties
      before_action :setup_property, only: :index, if: -> { can?(:create, model_class) }
      before_action :setup_variant_property_rules, only: :index

      private

        def find_properties
          @properties = Spree::Property.pluck(:name)
        end

        def setup_property
          @product.product_properties.build
        end

        def setup_variant_property_rules
          @option_types = @product.variant_option_values_by_option_type
          @option_value_ids = (params[:ovi] || []).reject(&:blank?).map(&:to_i)
          @variant_property_rule = @product.find_variant_property_rule(@option_value_ids) || @product.variant_property_rules.build
          @variant_property_rule.values.build if can?(:create, Spree::VariantPropertyRuleValue)
        end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_backend-1.2.3 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.1.4 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.2.2 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.2.1 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.1.3 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.2.0 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.2.0.rc2 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.1.2 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.2.0.rc1 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.2.0.beta1 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.1.1 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.1.0 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.1.0.pre2 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.1.0.pre1 app/controllers/spree/admin/product_properties_controller.rb
solidus_backend-1.1.0.beta1 app/controllers/spree/admin/product_properties_controller.rb