diff --git a/app/controllers/registrar/nameservers_controller.rb b/app/controllers/registrar/nameservers_controller.rb index e5bdd2747..bda879862 100644 --- a/app/controllers/registrar/nameservers_controller.rb +++ b/app/controllers/registrar/nameservers_controller.rb @@ -29,6 +29,10 @@ class Registrar::NameserversController < RegistrarController @nameservers = @q.result.page(params[:page]) end + def replace_all + @domain_params = { nameservers_attributes: { 0 => {} } } + end + private def can_replace_hostnames? diff --git a/app/views/registrar/nameservers/replace_all.haml b/app/views/registrar/nameservers/replace_all.haml new file mode 100644 index 000000000..6d8bc2f00 --- /dev/null +++ b/app/views/registrar/nameservers/replace_all.haml @@ -0,0 +1,38 @@ +- 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/routes.rb b/config/routes.rb index 7b1e3e318..0a6f5ebc3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -57,7 +57,7 @@ Rails.application.routes.draw do resources :nameservers do collection do - get 'replace_hostnames' + match 'replace_all', via: [:post, :get] end end