Class: Workarea::Admin::CreatePricingDiscountsController
Instance Method Summary
collapse
#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model
Methods included from Publishing
#allow_publishing!, #allow_publishing?, #set_publishing_options
Methods included from Visiting
#most_visited
Instance Method Details
#create ⇒ Object
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/workarea/admin/create_pricing_discounts_controller.rb', line 12
def create
@discount.attributes = params[:discount] unless @discount.new_record?
if @discount.save
flash[:success] = t('workarea.admin.create_pricing_discounts.flash_messages.saved')
redirect_to publish_create_pricing_discount_path(@discount, type: params[:type])
else
render :rules, status: :unprocessable_entity
end
end
|
#destroy ⇒ Object
48
49
50
51
|
# File 'app/controllers/workarea/admin/create_pricing_discounts_controller.rb', line 48
def destroy
@discount.destroy
redirect_to create_pricing_discounts_path
end
|
#details ⇒ Object
27
28
|
# File 'app/controllers/workarea/admin/create_pricing_discounts_controller.rb', line 27
def details
end
|
#edit ⇒ Object
23
24
25
|
# File 'app/controllers/workarea/admin/create_pricing_discounts_controller.rb', line 23
def edit
render :setup
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/workarea/admin/create_pricing_discounts_controller.rb', line 8
def index
render :setup
end
|
#publish ⇒ Object
33
34
|
# File 'app/controllers/workarea/admin/create_pricing_discounts_controller.rb', line 33
def publish
end
|
#rules ⇒ Object
30
31
|
# File 'app/controllers/workarea/admin/create_pricing_discounts_controller.rb', line 30
def rules
end
|
#save_publish ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/workarea/admin/create_pricing_discounts_controller.rb', line 36
def save_publish
publish = SavePublishing.new(@discount, params)
if publish.perform
flash[:success] = t('workarea.admin.create_pricing_discounts.flash_messages.created')
redirect_to pricing_discount_path(@discount)
else
flash[:error] = publish.errors.full_messages
render :publish
end
end
|