mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Pending history and admin controls #2557
This commit is contained in:
parent
6986b7b738
commit
07e4c0cd96
10 changed files with 95 additions and 84 deletions
35
app/controllers/admin/pendings_controller.rb
Normal file
35
app/controllers/admin/pendings_controller.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
class Admin::PendingsController < AdminController
|
||||
before_action :find_domain
|
||||
before_action :check_status
|
||||
|
||||
def update
|
||||
authorize! :update, :pending
|
||||
|
||||
@epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending
|
||||
if @epp_domain.apply_pending_update!
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:successfully_updated)
|
||||
else
|
||||
redirect_to admin_edit_domain_path(@domain.id), alert: t(:failure)
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
authorize! :destroy, :pending
|
||||
|
||||
if @domain.clean_pendings!
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:successfully_destroyed)
|
||||
else
|
||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_domain
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
end
|
||||
|
||||
def check_status
|
||||
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_update?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue