mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +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
|
def create
|
||||||
@domain = Domain.find(params[:domain_id])
|
@domain = Domain.find(params[:domain_id])
|
||||||
|
|
||||||
if @domain.can_add_nameserver?
|
unless @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
|
|
||||||
@nameserver = @domain.nameservers.build(nameserver_params)
|
@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')
|
flash.now[:alert] = I18n.t('shared.failed_to_add_nameserver')
|
||||||
render 'new'
|
render 'new'
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,7 @@ class Admin::TechContactsController < ApplicationController
|
||||||
before_action :set_domain
|
before_action :set_domain
|
||||||
before_action :set_contact, only: [:destroy]
|
before_action :set_contact, only: [:destroy]
|
||||||
|
|
||||||
def new
|
def new; end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
contact = Contact.find_by(id: params[:tech_contact_id])
|
contact = Contact.find_by(id: params[:tech_contact_id])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue