Sha256: d19c136f3399e7f01dac25fa007cbd76b7aa7133358fb307ce43fb4d2eaaa5e8

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

module Spree
  class StoreController < Spree::BaseController
    include Spree::Core::ControllerHelpers::Order

    skip_before_action :set_current_order, only: :cart_link

    def unauthorized
      render 'spree/shared/unauthorized', :layout => Spree::Config[:layout], :status => 401
    end

    def cart_link
      render :partial => 'spree/shared/link_to_cart'
      fresh_when(simple_current_order)
    end

    protected
      # This method is placed here so that the CheckoutController
      # and OrdersController can both reference it (or any other controller
      # which needs it)
      def apply_coupon_code
        if params[:order] && params[:order][:coupon_code]
          @order.coupon_code = params[:order][:coupon_code]

          handler = PromotionHandler::Coupon.new(@order).apply

          if handler.error.present?
            flash.now[:error] = handler.error
            respond_with(@order) { |format| format.html { render :edit } } and return
          elsif handler.success
            flash[:success] = handler.success
          end
        end
      end

      def config_locale
        Spree::Frontend::Config[:locale]
      end

      def lock_order
        OrderMutex.with_lock!(@order) { yield }
      rescue Spree::OrderMutex::LockFailed => e
        flash[:error] = Spree.t(:order_mutex_error)
        redirect_to spree.cart_path
      end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
solidus_frontend-1.0.7 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.6 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.5 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.4 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.3 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.2 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.1 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.0 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.0.rc2 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.0.rc1 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.0.pre3 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.0.pre2 app/controllers/spree/store_controller.rb
solidus_frontend-1.0.0.pre app/controllers/spree/store_controller.rb