mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Add basic form for mass replacing nameservers
This commit is contained in:
parent
4c503b6c1a
commit
61577f1d75
3 changed files with 43 additions and 1 deletions
|
@ -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?
|
||||
|
|
38
app/views/registrar/nameservers/replace_all.haml
Normal file
38
app/views/registrar/nameservers/replace_all.haml
Normal file
|
@ -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")
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue