Class: Admin::WholesalersController

Inherits:
BaseController
  • Object
show all
Includes:
SpreeWholesale::WholesalerController
Defined in:
app/controllers/admin/wholesalers_controller.rb

Instance Method Summary collapse

Methods included from SpreeWholesale::WholesalerController

included

Instance Method Details

#approval_setupObject



32
33
34
35
# File 'app/controllers/admin/wholesalers_controller.rb', line 32

def approval_setup
  @wholesaler = Wholesaler.find(params[:id])
  @role = Role.find_by_name("wholesaler")
end

#approveObject



20
21
22
23
24
# File 'app/controllers/admin/wholesalers_controller.rb', line 20

def approve
  return redirect_to request.referer, :flash => { :error => "Wholesaler is already active." } if @wholesaler.active?
  @wholesaler.activate!
  redirect_to request.referer, :flash => { :notice => "Wholesaler was successfully approved." }
end

#rejectObject



26
27
28
29
30
# File 'app/controllers/admin/wholesalers_controller.rb', line 26

def reject
  return redirect_to request.referer, :flash => { :error => "Wholesaler is already rejected." } unless @wholesaler.active?
  @wholesaler.deactivate!
  redirect_to request.referer, :flash => { :notice => "Wholesaler was successfully rejected." }
end