mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 10:16:01 +02:00
Refactor
This commit is contained in:
parent
a9ee1cdad1
commit
76d397465e
2 changed files with 12 additions and 8 deletions
|
@ -10,12 +10,18 @@ class Admin::NameserversController < ApplicationController
|
|||
def create
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
|
||||
if @domain.can_add_nameserver?
|
||||
@domain.nameservers.build(nameserver_params)
|
||||
flash[:notice] = I18n.t('shared.nameserver_added')
|
||||
redirect_to [:admin, @domain] and return if @domain.save
|
||||
else
|
||||
unless @domain.can_add_nameserver?
|
||||
@nameserver = @domain.nameservers.build(nameserver_params)
|
||||
flash.now[:alert] = I18n.t('shared.failed_to_add_nameserver')
|
||||
render 'new' and return
|
||||
end
|
||||
|
||||
@domain.nameservers.build(nameserver_params)
|
||||
|
||||
if @domain.save
|
||||
flash[:notice] = I18n.t('shared.nameserver_added')
|
||||
redirect_to [:admin, @domain]
|
||||
else
|
||||
flash.now[:alert] = I18n.t('shared.failed_to_add_nameserver')
|
||||
render 'new'
|
||||
end
|
||||
|
|
|
@ -2,9 +2,7 @@ class Admin::TechContactsController < ApplicationController
|
|||
before_action :set_domain
|
||||
before_action :set_contact, only: [:destroy]
|
||||
|
||||
def new
|
||||
|
||||
end
|
||||
def new; end
|
||||
|
||||
def create
|
||||
contact = Contact.find_by(id: params[:tech_contact_id])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue