Sha256: 2471e75be05851921e0f3cd675fe1f725d4f262dffc449722863540cf9b1e3c7
Contents?: true
Size: 845 Bytes
Versions: 1
Compression:
Stored size: 845 Bytes
Contents
module Spree module Admin TaxonsController.class_eval do 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), :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.2 | app/controllers/spree/admin/taxons_controller_decorator.rb |