Class: SolidusAdmin::PaymentMethodsController

Inherits:
BaseController
  • Object
show all
Includes:
ControllerHelpers::Search
Defined in:
app/controllers/solidus_admin/payment_methods_controller.rb

Instance Method Summary collapse

Methods included from ComponentsHelper

#component

Instance Method Details

#destroyObject



36
37
38
39
40
41
42
43
# File 'app/controllers/solidus_admin/payment_methods_controller.rb', line 36

def destroy
  @payment_methods = Spree::PaymentMethod.where(id: params[:id])

  Spree::PaymentMethod.transaction { @payment_methods.destroy_all }

  flash[:notice] = t('.success')
  redirect_back_or_to payment_methods_path, status: :see_other
end

#indexObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/solidus_admin/payment_methods_controller.rb', line 15

def index
  payment_methods = apply_search_to(
    Spree::PaymentMethod.ordered_by_position,
    param: :q,
  )

  set_page_and_extract_portion_from(payment_methods)

  respond_to do |format|
    format.html { render component('payment_methods/index').new(page: @page) }
  end
end

#moveObject



28
29
30
31
32
33
34
# File 'app/controllers/solidus_admin/payment_methods_controller.rb', line 28

def move
  @payment_method.insert_at(params[:position].to_i)

  respond_to do |format|
    format.js { head :no_content }
  end
end