mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Merge pull request #2126 from internetee/714-registrar-credit-changing-functionality
Admin: the functionality to change registrar credit balance
This commit is contained in:
commit
c1c9304377
19 changed files with 286 additions and 6 deletions
30
app/controllers/admin/accounts_controller.rb
Normal file
30
app/controllers/admin/accounts_controller.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
module Admin
|
||||
class AccountsController < BaseController
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@q = Account.includes(:registrar).search(params[:q])
|
||||
@accounts = @q.result.page(params[:page])
|
||||
@accounts = @accounts.per(params[:results_per_page]) if paginate?
|
||||
|
||||
render_by_format('admin/accounts/index', 'accounts')
|
||||
end
|
||||
|
||||
def show; end
|
||||
|
||||
def edit; end
|
||||
|
||||
def update
|
||||
action = Actions::AccountActivityCreate.new(@account,
|
||||
params[:account][:balance],
|
||||
params[:description],
|
||||
AccountActivity::UPDATE_CREDIT)
|
||||
if action.call
|
||||
redirect_to admin_accounts_path, notice: t('.updated')
|
||||
else
|
||||
flash[:alert] = t('invalid_balance')
|
||||
render 'edit'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue