Class: Workarea::Admin::PricingDiscountCodeListsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#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

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb', line 17

def create
  if @code_list.save
    flash[:success] = t('workarea.admin.pricing_discount_code_lists.flash_messages.generated')
    redirect_to pricing_discount_code_list_path(@code_list)
  else
    flash[:error] = t('workarea.admin.pricing_discount_code_lists.flash_messages.saved_error')
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



39
40
41
42
43
# File 'app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb', line 39

def destroy
  @code_list.destroy
  flash[:success] = t('workarea.admin.pricing_discount_code_lists.flash_messages.removed')
  redirect_to pricing_discount_code_lists_path
end

#editObject



27
# File 'app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb', line 27

def edit; end

#indexObject



7
8
9
# File 'app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb', line 7

def index
  @code_lists = Pricing::Discount::CodeList.all.page(params[:page])
end

#newObject



15
# File 'app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb', line 15

def new; end

#promo_codesObject



13
# File 'app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb', line 13

def promo_codes; end

#showObject



11
# File 'app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb', line 11

def show; end

#updateObject



29
30
31
32
33
34
35
36
37
# File 'app/controllers/workarea/admin/pricing_discount_code_lists_controller.rb', line 29

def update
  if @code_list.update(params[:code_list])
    flash[:success] = t('workarea.admin.pricing_discount_code_lists.flash_messages.updated')
    redirect_to pricing_discount_code_list_path(@code_list)
  else
    flash[:error] = t('workarea.admin.pricing_discount_code_lists.flash_messages.saved_error')
    render :edit, status: :unprocessable_entity
  end
end