Move Remove clientHold button to domain info

This commit is contained in:
Alex Sherman 2020-02-19 18:39:18 +05:00
parent 3b332da0bb
commit 5ec2d25ec5
7 changed files with 13 additions and 10 deletions

View file

@ -59,6 +59,7 @@ class Registrar
def info
authorize! :info, Depp::Domain
@data = @domain.info(params[:domain_name]) if params[:domain_name]
@client_holded = client_holded(@data)
if response_ok?
render 'info'
else
@ -158,6 +159,8 @@ class Registrar
return unless params[:domain_name]
@data = @domain.remove_hold(params)
flash[:alert] = @data.css('msg').text unless response_ok?
redirect_to info_registrar_domains_url(domain_name: params[:domain_name])
end
@ -167,6 +170,10 @@ class Registrar
@domain = Depp::Domain.new(current_user: depp_current_user)
end
def client_holded(data)
data.css('status')&.map { |element| element.attribute('s').value }
&.any? { |status| status == DomainStatus::CLIENT_HOLD }
end
def contacts
current_registrar_user.registrar.contacts