Add admin UI for BankGateway
This commit is contained in:
parent
87fe9ccdb1
commit
79fdb4dafb
11 changed files with 99 additions and 0 deletions
41
app/controllers/admin/bank_gateways_controller.rb
Normal file
41
app/controllers/admin/bank_gateways_controller.rb
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
class Admin::BankGatewaysController < Admin::BaseController
|
||||
inherit_resources
|
||||
|
||||
def new
|
||||
@bank_gateway = BankGateway.new(params[:bank_gateway])
|
||||
render layout: false
|
||||
end
|
||||
|
||||
def create
|
||||
@bank_gateway = BankGateway.new(params[:bank_gateway])
|
||||
if @bank_gateway.valid? && @bank_gateway.save
|
||||
redirect_to update_bank_gateways_admin_finances_url, status: :see_other
|
||||
else
|
||||
render action: 'new', layout: false
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@bank_gateway = BankGateway.find(params[:id])
|
||||
render action: 'new', layout: false
|
||||
end
|
||||
|
||||
def update
|
||||
@bank_gateway = BankGateway.find(params[:id])
|
||||
|
||||
if @bank_gateway.update(params[:bank_gateway])
|
||||
redirect_to update_bank_gateways_admin_finances_url, status: :see_other
|
||||
else
|
||||
render action: 'new', layout: false
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@bank_gateway = BankGateway.find(params[:id])
|
||||
@bank_gateway.destroy
|
||||
redirect_to update_bank_gateways_admin_finances_url, status: :see_other
|
||||
rescue StandardError => e
|
||||
flash.now[:alert] = e.message
|
||||
render template: 'shared/alert'
|
||||
end
|
||||
end
|
||||
|
|
@ -3,6 +3,7 @@ class Admin::FinancesController < Admin::BaseController
|
|||
|
||||
def index
|
||||
@bank_accounts = BankAccount.order('name')
|
||||
@bank_gateways = BankGateway.order('name')
|
||||
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
||||
end
|
||||
|
||||
|
|
@ -11,6 +12,11 @@ class Admin::FinancesController < Admin::BaseController
|
|||
render :layout => false
|
||||
end
|
||||
|
||||
def update_bank_gateways
|
||||
@bank_gateways = BankGateway.order('name')
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def update_transaction_types
|
||||
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
||||
render :layout => false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue