Disable namesservers massupdate

This commit is contained in:
Priit Tark 2015-05-19 16:25:29 +03:00
parent 66b00b7a77
commit 61cbc38a11
3 changed files with 48 additions and 44 deletions

View file

@ -1,46 +1,48 @@
class Registrar::NameserversController < RegistrarController class Registrar::NameserversController < RegistrarController
load_and_authorize_resource # turned off requested by client
def index # load_and_authorize_resource
if can_replace_hostnames?
prc = Nameserver.replace_hostname_ends(
current_user.registrar.domains.includes(
:registrant, :nameservers, :admin_domain_contacts, :tech_domain_contacts, :domain_statuses,
:versions, :admin_contacts, :tech_contacts, :whois_record, :dnskeys
),
params[:q][:hostname_end],
params[:hostname_end_replacement]
)
if prc == 'replaced_none' # def index
flash.now[:alert] = t(:no_hostnames_replaced) # if can_replace_hostnames?
elsif prc == 'replaced_all' # prc = Nameserver.replace_hostname_ends(
params[:q][:hostname_end] = params[:hostname_end_replacement] # current_user.registrar.domains.includes(
params[:hostname_end_replacement] = nil # :registrant, :nameservers, :admin_domain_contacts, :tech_domain_contacts, :domain_statuses,
flash.now[:notice] = t(:all_hostnames_replaced) # :versions, :admin_contacts, :tech_contacts, :whois_record, :dnskeys
else # ),
flash.now[:warning] = t(:hostnames_partially_replaced) # params[:q][:hostname_end],
end # params[:hostname_end_replacement]
end # )
nameservers = current_user.registrar.nameservers.includes(:domain) # if prc == 'replaced_none'
@q = nameservers.search(params[:q]) # flash.now[:alert] = t(:no_hostnames_replaced)
@q.sorts = 'id desc' if @q.sorts.empty? # elsif prc == 'replaced_all'
@nameservers = @q.result.page(params[:page]) # params[:q][:hostname_end] = params[:hostname_end_replacement]
end # params[:hostname_end_replacement] = nil
# flash.now[:notice] = t(:all_hostnames_replaced)
# else
# flash.now[:warning] = t(:hostnames_partially_replaced)
# end
# end
def replace_all # nameservers = current_user.registrar.nameservers.includes(:domain)
@domain_params = { nameservers_attributes: { 0 => {} } } # @q = nameservers.search(params[:q])
end # @q.sorts = 'id desc' if @q.sorts.empty?
# @nameservers = @q.result.page(params[:page])
# end
private # def replace_all
# @domain_params = { nameservers_attributes: { 0 => {} } }
# end
def can_replace_hostnames? # private
if params[:replace] && params[:q]
flash.now[:alert] = t('hostname_end_replacement_is_required') unless params[:hostname_end_replacement].present? # def can_replace_hostnames?
flash.now[:alert] = t('hostname_end_is_required') unless params[:q][:hostname_end].present? # if params[:replace] && params[:q]
return true if flash[:alert].blank? # flash.now[:alert] = t('hostname_end_replacement_is_required') unless params[:hostname_end_replacement].present?
end # flash.now[:alert] = t('hostname_end_is_required') unless params[:q][:hostname_end].present?
false # return true if flash[:alert].blank?
end # end
# false
# end
end end

View file

@ -1,8 +1,9 @@
- content_for :actions do - content_for :actions do
= link_to(t(:new), new_registrar_domain_path, class: 'btn btn-primary') = link_to(t(:new), new_registrar_domain_path, class: 'btn btn-primary')
= link_to(t(:transfer), transfer_registrar_domains_path, class: 'btn btn-default') = link_to(t(:transfer), transfer_registrar_domains_path, class: 'btn btn-default')
-# turned off requested by client
-# = link_to(t(:keyrelay), registrar_keyrelay_path, class: 'btn btn-default') -# = link_to(t(:keyrelay), registrar_keyrelay_path, class: 'btn btn-default')
= link_to(t(:nameservers), registrar_nameservers_path, class: 'btn btn-default') -# = link_to(t(:nameservers), registrar_nameservers_path, class: 'btn btn-default')
= render 'shared/title', name: t(:domains) = render 'shared/title', name: t(:domains)
.row .row

View file

@ -57,11 +57,12 @@ Rails.application.routes.draw do
end end
end end
resources :nameservers do # turned off requested by client
collection do # resources :nameservers do
match 'replace_all', via: [:post, :get] # collection do
end # match 'replace_all', via: [:post, :get]
end # end
# end
resources :contacts do resources :contacts do
member do member do