Class: Spree::Admin::PromotionActionsController
- Inherits:
-
BaseController
- Object
- BaseController
- BaseController
- Spree::Admin::PromotionActionsController
show all
- Defined in:
- app/controllers/spree/admin/promotion_actions_controller.rb
Instance Method Summary
collapse
#set_user_language_locale_key
Instance Method Details
#create ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/spree/admin/promotion_actions_controller.rb', line 7
def create
@calculators = Rails.application.config.spree.calculators.promotion_actions_create_adjustments
@promotion_action = @promotion_action_type.new(params[:promotion_action])
@promotion_action.promotion = @promotion
if @promotion_action.save
flash[:success] = t('spree.successfully_created', resource: t('spree.promotion_action'))
end
respond_to do |format|
format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
format.js { render layout: false }
end
end
|
#destroy ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/spree/admin/promotion_actions_controller.rb', line 20
def destroy
@promotion_action = @promotion.promotion_actions.find(params[:id])
if @promotion_action.discard
flash[:success] = t('spree.successfully_removed', resource: t('spree.promotion_action'))
end
respond_to do |format|
format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
format.js { render layout: false }
end
end
|