Sha256: 6cb6f6d58fdaedba283cf5e584005ffcb73cdeb4c5d32b21575e5fed43bcd5d8

Contents?: true

Size: 839 Bytes

Versions: 11

Compression:

Stored size: 839 Bytes

Contents

module Spree
  module Admin  
    class ZonedController < BaseController

      def setcountry
        respond_to do |format|
          format.js do
            session[:zoned] ||= {}
            session[:zoned][:prd_country] = params[%s{sel-prd-country}]
          end
        end
      end

      def reorder
        country = session[:zoned] && session[:zoned][:prd_country]
        return if !country || country.to_i >= 0
        country = country.to_i
        params[:positions].each do |id, index|
          Spree::Zoned::Product.find_or_create_by_spree_product_id_and_spree_country_id(id, country).update_attributes :orderno => index.to_i
        end
        respond_to do |format|
          format.html { redirect_to admin_products_url }
          format.js  { render :text => 'Ok' }
        end
      end

    end      
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
spree_zoned-0.5.23 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.22 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.21 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.20 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.19 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.18 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.17 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.16 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.15 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.14 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.13 app/controllers/spree/admin/zoned_controller.rb