Sha256: fe27e78ac2494db1346ae7ad6f08520c5d895cd2dc5fbd972f1a197d23ca81dd

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

class Spree::Admin::PromotionActionsController < Spree::Admin::BaseController
  def create
    @calculators = Spree::Promotion::Actions::CreateAdjustment.calculators
    @promotion = Spree::Promotion.find(params[:promotion_id])
    @promotion_action = params[:action_type].constantize.new(params[:promotion_action])
    @promotion_action.promotion = @promotion
    if @promotion_action.save
      flash[:success] = I18n.t(:successfully_created, :resource => I18n.t(:promotion_action))
    end
    respond_to do |format|
      format.html { redirect_to spree.edit_admin_promotion_path(@promotion)}
      format.js   { render :layout => false }
    end
  end

  def destroy
    @promotion = Spree::Promotion.find(params[:promotion_id])
    @promotion_action = @promotion.promotion_actions.find(params[:id])
    if @promotion_action.destroy
      flash[:success] = I18n.t(:successfully_removed, :resource => I18n.t(:promotion_action))
    end
    respond_to do |format|
      format.html { redirect_to spree.edit_admin_promotion_path(@promotion)}
      format.js   { render :layout => false }
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spree_promo-1.3.5 app/controllers/spree/admin/promotion_actions_controller.rb
spree_promo-1.3.4 app/controllers/spree/admin/promotion_actions_controller.rb
spree_promo-1.3.3 app/controllers/spree/admin/promotion_actions_controller.rb
spree_promo-1.3.2 app/controllers/spree/admin/promotion_actions_controller.rb
spree_promo-1.3.1 app/controllers/spree/admin/promotion_actions_controller.rb
spree_promo-1.3.0 app/controllers/spree/admin/promotion_actions_controller.rb
spree_promo-1.3.0.rc2 app/controllers/spree/admin/promotion_actions_controller.rb
dup_spree_promo-1.3.0.rc1 app/controllers/spree/admin/promotion_actions_controller.rb
spree_promo-1.3.0.rc1 app/controllers/spree/admin/promotion_actions_controller.rb