Sha256: 4a5ecf80d60c7373194138b19e6bbad601cf13cb8fd7a6e7d25fe4aca9bd0df4

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

class Spree::Admin::PromotionRulesController < Spree::Admin::BaseController
  helper 'spree/promotion_rules'

  def create
    @promotion = Spree::Promotion.find(params[:promotion_id])
    @promotion_rule = params[:promotion_rule][:type].constantize.new(params[:promotion_rule])
    @promotion_rule.promotion = @promotion
    if @promotion_rule.save
      flash.notice = I18n.t(:successfully_created, :resource => I18n.t(:promotion_rule))
    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_rule = @promotion.promotion_rules.find(params[:id])
    if @promotion_rule.destroy
      flash.notice = I18n.t(:successfully_removed, :resource => I18n.t(:promotion_rule))
    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 & 1 rubygems

Version Path
spree_promo-1.0.7 app/controllers/spree/admin/promotion_rules_controller.rb
spree_promo-1.0.6 app/controllers/spree/admin/promotion_rules_controller.rb
spree_promo-1.0.4 app/controllers/spree/admin/promotion_rules_controller.rb
spree_promo-1.0.3 app/controllers/spree/admin/promotion_rules_controller.rb
spree_promo-1.0.2 app/controllers/spree/admin/promotion_rules_controller.rb
spree_promo-1.0.1 app/controllers/spree/admin/promotion_rules_controller.rb
spree_promo-1.0.0 app/controllers/spree/admin/promotion_rules_controller.rb
spree_promo-1.0.0.rc4 app/controllers/spree/admin/promotion_rules_controller.rb
spree_promo-1.0.0.rc3 app/controllers/spree/admin/promotion_rules_controller.rb