diff --git a/app/helpers/domains_helper.rb b/app/helpers/domains_helper.rb index 89db2fb..7c69184 100644 --- a/app/helpers/domains_helper.rb +++ b/app/helpers/domains_helper.rb @@ -1,25 +1,30 @@ module DomainsHelper # Human names for domain states def human_state(state) human = case state.to_sym when :initial then 'Initial' when :pending_install then 'Becoming public' when :pending_signing then 'Signing zone' when :wait_for_ready then 'Waiting for KSK to become ready' when :pending_ds then 'Publishing DS records' when :pending_ds_rollover then 'Performing KSK rollover' when :pending_plain then 'Removing dnssec' when :pending_remove then 'Preparing removal' when :operational then 'Operational' when :destroy then 'Ready to be destroyed' else state end prog = Domain.dnssec_progress(state) return human if prog.nil? "#{human} (#{prog})" end + + # Most of the time the parent zone will be easily computed + def guess_parent_zone(name) + name.split('.', 2).last || '' + end end diff --git a/app/views/domains/_dnssec_form.html.erb b/app/views/domains/_dnssec_form.html.erb index 03270ce..52f4624 100644 --- a/app/views/domains/_dnssec_form.html.erb +++ b/app/views/domains/_dnssec_form.html.erb @@ -1,13 +1,13 @@ <%= bootstrap_form_for(@domain, layout: :horizontal, label_col: 'col-sm-2', control_col: 'col-sm-4') do |f| %> <%= f.hidden_field :group_id %> <%= f.static_control :name %> <%= f.select :dnssec, [['Enable', true], ['Disable', false]] %>
> <%= f.collection_select :dnssec_policy_id, DnssecPolicy.all, :id, :name %> <%= f.select :dnssec_parent_authority, Domain.dnssec_parent_authorities, include_blank: true, label: 'Parent authority', help: 'WebDNS will manage DS records automatically, handling initial setup and key rollovers.' %> - <%= f.text_field :dnssec_parent, label: 'Parent zone', help: 'The parent zone to publish the DS records.' %> + <%= f.text_field :dnssec_parent, value: guess_parent_zone(@domain.name), label: 'Parent zone', help: 'The parent zone to publish the DS records.' %>
<%= f.submit 'Save', class: 'btn btn-primary col-sm-offset-2' %> <% end %>