Sha256: 38aaf9f69c45e96b2382e30c33c1bab4a8e511f9e4ff4e0cf67bca8270bd0a3f

Contents?: true

Size: 897 Bytes

Versions: 15

Compression:

Stored size: 897 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|
          zp = Spree::Zoned::Product.find_or_create_by_spree_product_id_and_spree_country_id(id, country)
          zp.orderno = index.to_i unless !zp.orderno.nil? && zp.orderno < 0
          zp.save
        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

15 entries across 15 versions & 1 rubygems

Version Path
spree_zoned-0.5.38 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.37 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.36 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.35 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.34 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.33 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.32 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.31 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.30 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.29 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.28 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.27 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.26 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.25 app/controllers/spree/admin/zoned_controller.rb
spree_zoned-0.5.24 app/controllers/spree/admin/zoned_controller.rb