Sha256: f53a262eaf9b739e1a80b2404ae8d0e95df996f8af4f920256495ad1763276f9

Contents?: true

Size: 831 Bytes

Versions: 26

Compression:

Stored size: 831 Bytes

Contents

module Spree
  module Admin
    class PromotionsController < ResourceController
      before_filter :load_data
      helper 'spree/promotion_rules'

      protected
        def build_resource
          if params[:promotion]
            calculator_type = params[:promotion].delete(:calculator_type)
            @promotion = Promotion.new(params[:promotion])
            if calculator_type
              @promotion.calculator = calculator_type.constantize.new
            end
          else
            @promotion = Promotion.new
          end
          @promotion
        end

        def location_after_save
          spree.edit_admin_promotion_url(@promotion)
        end

        def load_data
          @calculators = Rails.application.config.spree.calculators.promotion_actions_create_adjustments
        end
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
spree_promo-1.3.5 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.3.4 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.2.5 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.3.3 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.1.6 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.1.5 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.2.4 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.3.2 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.2.3 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.3.1 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.3.0 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.3.0.rc2 app/controllers/spree/admin/promotions_controller.rb
dup_spree_promo-1.3.0.rc1 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.3.0.rc1 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.2.2 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.1.4 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.2.0 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.2.0.rc2 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.2.0.rc1 app/controllers/spree/admin/promotions_controller.rb
spree_promo-1.1.3 app/controllers/spree/admin/promotions_controller.rb