Sha256: 8e2f684d7f48bbaa56226e542130875d88d17ed654d82f0fa36be6774c889df9
Contents?: true
Size: 1.06 KB
Versions: 16
Compression:
Stored size: 1.06 KB
Contents
module Spree module Admin class OptionTypesController < ResourceController before_action :setup_new_option_value, only: :edit def update_values_positions params[:positions].each do |id, index| Spree::OptionValue.where(id: id).update_all(position: index) end respond_to do |format| format.html { redirect_to admin_product_variants_url(params[:product_id]) } format.js { render plain: 'Ok' } end end private def location_after_save edit_admin_option_type_url(@option_type) end def load_product @product = Spree::Product.find_by_param!(params[:product_id]) end def setup_new_option_value @option_type.option_values.build if @option_type.option_values.empty? end def set_available_option_types @available_option_types = if @product.option_type_ids.any? Spree::OptionType.where('id NOT IN (?)', @product.option_type_ids) else Spree::OptionType.all end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems