mirror of
https://github.com/internetee/registry.git
synced 2025-07-26 04:28:27 +02:00
DNS key form for UI
This commit is contained in:
parent
4b76e2ceec
commit
7b7383faf1
9 changed files with 87 additions and 12 deletions
|
@ -69,7 +69,8 @@ class Client::DomainsController < ClientController
|
|||
:owner_contact_typeahead,
|
||||
nameservers_attributes: [:id, :hostname, :ipv4, :ipv6, :_destroy],
|
||||
domain_contacts_attributes: [:id, :contact_type, :contact_id, :value_typeahead, :_destroy],
|
||||
domain_statuses_attributes: [:id, :value, :description, :_destroy]
|
||||
domain_statuses_attributes: [:id, :value, :description, :_destroy],
|
||||
dnskeys_attributes: [:id, :flags, :alg, :protocol, :public_key]
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -85,6 +86,7 @@ class Client::DomainsController < ClientController
|
|||
|
||||
def build_associations
|
||||
@domain.nameservers.build if @domain.nameservers.empty?
|
||||
@domain.dnskeys.build if @domain.dnskeys.empty?
|
||||
@domain.domain_contacts.build if @domain.domain_contacts.empty?
|
||||
|
||||
@client_statuses = @domain.domain_statuses.select(&:client_status?)
|
||||
|
|
|
@ -28,6 +28,7 @@ class Domain < ActiveRecord::Base
|
|||
has_many :domain_transfers, dependent: :delete_all
|
||||
|
||||
has_many :dnskeys, dependent: :delete_all
|
||||
accepts_nested_attributes_for :dnskeys, allow_destroy: true
|
||||
|
||||
delegate :code, to: :owner_contact, prefix: true
|
||||
delegate :email, to: :owner_contact, prefix: true
|
||||
|
|
25
app/views/admin/domains/partials/_dnskeys.haml
Normal file
25
app/views/admin/domains/partials/_dnskeys.haml
Normal file
|
@ -0,0 +1,25 @@
|
|||
- panel_class = @domain.errors.messages[:dnskeys] ? 'panel-danger' : 'panel-default'
|
||||
#dnskeys.panel{class: panel_class}
|
||||
.panel-heading.clearfix
|
||||
= t('shared.dnskeys')
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-1'}= t('shared.flag')
|
||||
%th{class: 'col-xs-1'}= t('shared.protocol')
|
||||
%th{class: 'col-xs-1'}= t('shared.algorithm')
|
||||
%th{class: 'col-xs-9'}= t('shared.public_key')
|
||||
%tbody
|
||||
- @domain.dnskeys.each do |x|
|
||||
%tr
|
||||
%td= x.flags
|
||||
%td= x.protocol
|
||||
%td= x.alg
|
||||
%td= x.public_key
|
||||
- if @domain.errors.messages[:dnskeys]
|
||||
%tfoot
|
||||
- @domain.errors.messages[:dnskeys].each do |x|
|
||||
%tr
|
||||
%td{colspan: 4}= x
|
||||
|
|
@ -10,11 +10,13 @@
|
|||
.row
|
||||
.col-md-6= render 'admin/domains/partials/general'
|
||||
.col-md-6= render 'admin/domains/partials/owner'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/nameservers'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/statuses'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/tech_contacts'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/admin_contacts'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/statuses'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/nameservers'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/dnskeys'
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
= render 'client/domains/form_partials/contacts', f: f
|
||||
%hr
|
||||
= render 'client/domains/form_partials/nameservers', f: f
|
||||
%hr
|
||||
= render 'client/domains/form_partials/dnskeys', f: f
|
||||
#statuses-tab.tab-pane
|
||||
= render 'client/domains/form_partials/statuses', f: f
|
||||
.row
|
||||
|
|
37
app/views/client/domains/form_partials/_dnskeys.haml
Normal file
37
app/views/client/domains/form_partials/_dnskeys.haml
Normal file
|
@ -0,0 +1,37 @@
|
|||
#dnskeys
|
||||
= f.fields_for :dnskeys do |key_fields|
|
||||
.panel.panel-default
|
||||
.panel-heading.clearfix
|
||||
.pull-left= t('shared.dnskey')
|
||||
.pull-right
|
||||
= link_to(t('shared.add_another'), '#', class: 'btn btn-primary btn-xs add-dnskey')
|
||||
= link_to(t('shared.delete'), '#', class: 'btn btn-danger btn-xs destroy')
|
||||
.panel-body
|
||||
.errors
|
||||
= render 'shared/errors', object: key_fields.object
|
||||
- if key_fields.object.errors.any?
|
||||
%hr
|
||||
.row
|
||||
.col-md-4
|
||||
.form-group
|
||||
= key_fields.label :flags
|
||||
= key_fields.text_field :flags, class: 'form-control'
|
||||
.col-md-4
|
||||
.form-group
|
||||
= key_fields.label :protocol
|
||||
= key_fields.text_field :protocol, class: 'form-control'
|
||||
.col-md-4
|
||||
.form-group
|
||||
= key_fields.label :alg
|
||||
= key_fields.text_field :alg, class: 'form-control'
|
||||
.row
|
||||
.col-md-12
|
||||
= key_fields.label :public_key
|
||||
= key_fields.text_field :public_key, class: 'form-control'
|
||||
:javascript
|
||||
$("#dnskeys").nestedAttributes({
|
||||
bindAddTo: $(".add-dnskey"),
|
||||
afterAdd: function(item) {
|
||||
item.find('.errors').html('');
|
||||
}
|
||||
});
|
|
@ -11,11 +11,13 @@
|
|||
.row
|
||||
.col-md-6= render 'client/domains/partials/general'
|
||||
.col-md-6= render 'client/domains/partials/owner'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/nameservers'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/statuses'
|
||||
.row
|
||||
.col-md-12= render 'client/domains/partials/tech_contacts'
|
||||
.row
|
||||
.col-md-12= render 'client/domains/partials/admin_contacts'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/statuses'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/nameservers'
|
||||
.row
|
||||
.col-md-12= render 'admin/domains/partials/dnskeys'
|
||||
|
|
|
@ -391,6 +391,13 @@ en:
|
|||
edit_epp_user: 'Edit EPP user'
|
||||
back_to_epp_user: 'Back to EPP user'
|
||||
|
||||
dnskey: 'DNS key'
|
||||
dnskeys: 'DNS Keys'
|
||||
flag: 'Flag'
|
||||
protocol: 'Protocol'
|
||||
algorithm: 'Algorithm'
|
||||
public_key: 'Public key'
|
||||
|
||||
record_created: 'Record created'
|
||||
failed_to_create_record: 'Failed to create record'
|
||||
record_updated: 'Record updated'
|
||||
|
|
|
@ -693,9 +693,6 @@ describe 'EPP Domain', epp: true do
|
|||
dnssec: [
|
||||
{
|
||||
dnskey: {
|
||||
flags: { value: '0' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '5' },
|
||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue