Sha256: 5504746c0aa642bd3b9d02db1f3a3528ee38dd7be7f55e9795e59f2d243c4be2
Contents?: true
Size: 871 Bytes
Versions: 1
Compression:
Stored size: 871 Bytes
Contents
module Spree module Admin class TaxonsController < Spree::Admin::BaseController before_filter :load_taxon, :only => [:sort_products, :update_products] def sort_products @products = @taxon.products end def update_products products = @taxon.products_taxons product_ids_positions = params[:product_positions].split(",").map(&:to_i) product_ids_positions.each_with_index do |id, index| product = products.detect{|p| p.product_id == id } product.update_attributes(:position => index) unless product.nil? end redirect_to sort_products_taxons_path(@taxonomy, @taxon.id), :notice => t(:sort_products_taxons_update_message) end def load_taxon @taxonomy = Taxonomy.find(params[:taxonomy_id]) @taxon = Taxon.find(params[:id]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_sort_products-1.3.4 | app/controllers/spree/admin/taxons_controller_decorator.rb |