From cd3212cc040cc3b493f40a8eda94c1926e350464 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Sun, 9 Apr 2017 14:37:32 +0300 Subject: [PATCH] Remove unused registrar name servers controller --- .../registrar/nameservers_controller.rb | 48 --------------- app/views/registrar/nameservers/index.haml | 61 ------------------- .../registrar/nameservers/replace_all.haml | 38 ------------ config/locales/en.yml | 10 --- config/routes.rb | 7 --- 5 files changed, 164 deletions(-) delete mode 100644 app/controllers/registrar/nameservers_controller.rb delete mode 100644 app/views/registrar/nameservers/index.haml delete mode 100644 app/views/registrar/nameservers/replace_all.haml diff --git a/app/controllers/registrar/nameservers_controller.rb b/app/controllers/registrar/nameservers_controller.rb deleted file mode 100644 index ea4d9568b..000000000 --- a/app/controllers/registrar/nameservers_controller.rb +++ /dev/null @@ -1,48 +0,0 @@ -class Registrar::NameserversController < RegistrarController - # turned off requested by client - - # load_and_authorize_resource - - # def index - # 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' - # flash.now[:alert] = t(:no_hostnames_replaced) - # elsif prc == 'replaced_all' - # params[:q][:hostname_end] = params[:hostname_end_replacement] - # params[:hostname_end_replacement] = nil - # flash.now[:notice] = t(:all_hostnames_replaced) - # else - # flash.now[:warning] = t(:hostnames_partially_replaced) - # end - # end - - # nameservers = current_user.registrar.nameservers.includes(:domain) - # @q = nameservers.search(params[:q]) - # @q.sorts = 'id desc' if @q.sorts.empty? - # @nameservers = @q.result.page(params[:page]) - # end - - # def replace_all - # @domain_params = { nameservers_attributes: { 0 => {} } } - # end - - # private - - # def can_replace_hostnames? - # if params[:replace] && params[:q] - # flash.now[:alert] = t('hostname_end_replacement_is_required') unless params[:hostname_end_replacement].present? - # flash.now[:alert] = t('hostname_end_is_required') unless params[:q][:hostname_end].present? - # return true if flash[:alert].blank? - # end - # false - # end -end diff --git a/app/views/registrar/nameservers/index.haml b/app/views/registrar/nameservers/index.haml deleted file mode 100644 index 915b0d935..000000000 --- a/app/views/registrar/nameservers/index.haml +++ /dev/null @@ -1,61 +0,0 @@ -- content_for :actions do - = link_to(t(:back_to_domains), registrar_domains_path, class: 'btn btn-default') -= render 'shared/title', name: t(:nameservers) - -.row - .col-md-12 - = search_form_for @q, url: [:registrar, :nameservers], html: { style: 'margin-bottom: 0;' } do |f| - .row - .col-md-3 - .form-group - = f.label t(:hostname_end) - = f.search_field :hostname_end, class: 'form-control', placeholder: t(:hostname_end), autocomplete: 'off' - .col-md-3 - .form-group - = label_tag t(:hostname_end_replacement) - = text_field_tag :hostname_end_replacement, params[:hostname_end_replacement], class: 'form-control', placeholder: t(:hostname_end_replacement), autocomplete: 'off' - .col-md-4{style: 'padding-top: 25px;'} - %button.btn.btn-default -   - %span.glyphicon.glyphicon-search -   - %button.btn.btn-default.js-reset-form - = t(:clear_fields) - %button.btn.btn-warning{name: 'replace'} - = t(:replace) - .row - .col-md-12 - %p.help-block= t(:hostnames_will_be_replaced_only_if_domain_validates_with_the_new_nameserver) -%hr -.row - .col-md-12 - .table-responsive - %table.table.table-hover.table-condensed - %thead - %tr - %th{class: 'col-xs-3'}= t(:hostname) - %th{class: 'col-xs-3'}= t(:ipv4) - %th{class: 'col-xs-3'}= t(:ipv6) - %th{class: 'col-xs-3'}= t(:domain) - %tbody - - @nameservers.each do |x| - %tr - - if params[:q] && params[:q][:hostname_end] - - hn = x.hostname.chomp(params[:q][:hostname_end]) - %td - = precede hn do - %strong= params[:q][:hostname_end] - - else - %td= x.hostname - %td= x.ipv4 - %td= x.ipv4 - %td= link_to(x.domain, info_registrar_domains_url(domain_name: x.domain.name)) -.row - .col-md-12 - = paginate @nameservers - -:coffee - $(".js-reset-form").on "click", (e) -> - e.preventDefault(); - window.location = "#{registrar_nameservers_path}" - diff --git a/app/views/registrar/nameservers/replace_all.haml b/app/views/registrar/nameservers/replace_all.haml deleted file mode 100644 index 6d8bc2f00..000000000 --- a/app/views/registrar/nameservers/replace_all.haml +++ /dev/null @@ -1,38 +0,0 @@ -- content_for :actions do - = link_to(t(:back_to_domains), registrar_domains_path, class: 'btn btn-default') -= render 'shared/title', name: t(:nameservers) - -= form_tag url: [:registrar, :replace_all], html: { style: 'margin-bottom: 0;' } do - #nameservers - - @domain_params[:nameservers_attributes].each do |k, v| - .panel.panel-default - .panel-heading.clearfix - .pull-left= t(:nameserver) - .pull-right - = link_to(t(:add_another), '#', class: 'btn btn-default btn-xs add-nameserver') - = link_to(t(:delete), '#', class: 'btn btn-default btn-xs destroy') - .panel-body - .form-group - .col-md-3.control-label - = label_tag "domain_nameservers_attributes_#{k}_hostname", t(:hostname), class: 'required' - .col-md-7 - = text_field_tag "domain[nameservers_attributes][#{k}][hostname]", v['hostname'], - class: 'form-control', required: true - .form-group - .col-md-3.control-label - = label_tag "domain_nameservers_attributes_#{k}_ipv4", t(:ipv4) - .col-md-7 - = text_field_tag "domain[nameservers_attributes][#{k}][ipv4]", v['ipv4'], - class: 'form-control', ipv4: true - .form-group - .col-md-3.control-label - = label_tag "domain_nameservers_attributes_#{k}_ipv6", t(:ipv6) - .col-md-7 - = text_field_tag "domain[nameservers_attributes][#{k}][ipv6]", v['ipv6'], - class: 'form-control', ipv6: true - .row - .col-md-8.text-right - = button_tag(t('shared.save'), class: 'btn btn-warning') -:coffee - $("#nameservers").nestedAttributes - bindAddTo: $(".add-nameserver") diff --git a/config/locales/en.yml b/config/locales/en.yml index 99b297c5e..9b08ab374 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -767,16 +767,6 @@ en: due_date_until: 'Due date until' minimum_total: 'Minimum total' maximum_total: 'Maximum total' - hostname_end: 'Hostname end' - hostname_end_replacement: 'Hostname end replacement' - hostname_end_is_required: 'Hostname end is required' - hostname_end_replacement_is_required: 'Hostname end replacement is required' - hostnames_replaced: 'Hostnames replaced' - all_hostnames_replaced: 'All hostnames replaced' - hostnames_partially_replaced: 'Hostnames partially replaced' - hostnames_will_be_replaced_only_if_domain_validates_with_the_new_nameserver: 'Hostnames will be replaced only if domain validates with the new nameserver' - back_to_domains: 'Back to domains' - no_hostnames_replaced: 'No hostnames replaced' forbidden_code: 'is forbidden to use' unimplemented_object_service: 'Unimplemented object service' contact_email_update_subject: 'Teie domeenide kontakt epostiaadress on muutunud / Contact e-mail addresses of your domains have changed' diff --git a/config/routes.rb b/config/routes.rb index 8b52e7091..de1d04f3c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -61,13 +61,6 @@ Rails.application.routes.draw do end end - # turned off requested by client - # resources :nameservers do - # collection do - # match 'replace_all', via: [:post, :get] - # end - # end - resources :contacts, constraints: {:id => /[^\/]+(?=#{ ActionController::Renderers::RENDERERS.map{|e| "\\.#{e}\\z"}.join("|") })|[^\/]+/} do member do get 'delete'