mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Domain editing for client
This commit is contained in:
parent
ef0eb7cbc6
commit
92984e19dd
29 changed files with 358 additions and 54 deletions
30
app/controllers/concerns/shared/common_domain.rb
Normal file
30
app/controllers/concerns/shared/common_domain.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
module Shared::CommonDomain
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_action :set_domain, only: [:show, :edit, :update, :destroy]
|
||||
before_action :verify_deletion, only: [:destroy]
|
||||
end
|
||||
|
||||
def edit
|
||||
build_associations
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_domain
|
||||
@domain = Domain.find(params[:id])
|
||||
end
|
||||
|
||||
def build_associations
|
||||
@domain.nameservers.build if @domain.nameservers.empty?
|
||||
@domain.domain_contacts.build if @domain.domain_contacts.empty?
|
||||
@domain.domain_statuses.build if @domain.domain_statuses.empty?
|
||||
end
|
||||
|
||||
def verify_deletion
|
||||
return if @domain.can_be_deleted?
|
||||
flash[:alert] = I18n.t('shared.domain_status_prohibits_deleting')
|
||||
redirect_to [:admin, @domain]
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue