Class: Plugins::Ecommerce::Admin::PaymentMethodsController

Inherits:
Plugins::Ecommerce::AdminController
  • Object
show all
Defined in:
app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb', line 25

def create
  @payment_method = current_site.payment_methods.new(payment_permit_data)
  if @payment_method.save
    @payment_method.set_meta('_default',params[:options])
    flash[:notice] = t('camaleon_cms.admin.post_type.message.created')
    redirect_to action: :index
  else
    render 'form'
  end
end

#editObject



20
21
22
23
# File 'app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb', line 20

def edit
  add_breadcrumb("#{t('camaleon_cms.admin.button.edit')}")
  render 'form'
end

#indexObject



4
5
6
# File 'app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb', line 4

def index
  @payment_methods = current_site.payment_methods.paginate(:page => params[:page], :per_page => current_site.admin_per_page)
end

#newObject



8
9
10
11
12
13
# File 'app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb', line 8

def new
  @payment_method = current_site.payment_methods.new
  @payment_method.status = 1
  add_breadcrumb("#{t('plugins.ecommerce.new')}")
  render 'form'
end

#showObject



15
16
17
18
# File 'app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb', line 15

def show
  add_breadcrumb("#{t('plugins.ecommerce.table.details')}")
  @payment_method = @payment_method.decorate
end

#updateObject



36
37
38
39
40
41
42
43
44
# File 'app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb', line 36

def update
  if @payment_method.update(payment_permit_data)
    @payment_method.set_meta('_default',params[:options])
    flash[:notice] = t('camaleon_cms.admin.post_type.message.updated')
    redirect_to action: :index
  else
    render 'form'
  end
end