mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 10:49:39 +02:00
Adding nameservers to domain
This commit is contained in:
parent
24e7beed5b
commit
c24c8c7181
10 changed files with 69 additions and 8 deletions
|
@ -5,6 +5,9 @@ class Admin::DomainsController < ApplicationController
|
|||
@domain = Domain.new
|
||||
end
|
||||
|
||||
def create
|
||||
end
|
||||
|
||||
def index
|
||||
@q = Domain.search(params[:q])
|
||||
@domains = @q.result.page(params[:page])
|
||||
|
@ -15,4 +18,8 @@ class Admin::DomainsController < ApplicationController
|
|||
def set_domain
|
||||
@domain = Domain.find(params[:id])
|
||||
end
|
||||
|
||||
def domain_params
|
||||
params.require(:domain).permit(:name, :period, :registrar, :owner_contact)
|
||||
end
|
||||
end
|
||||
|
|
21
app/controllers/admin/nameservers_controller.rb
Normal file
21
app/controllers/admin/nameservers_controller.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
class Admin::NameserversController < ApplicationController
|
||||
def new
|
||||
@domain = Domain.find_by(params[:id])
|
||||
@nameserver = @domain.nameservers.build
|
||||
end
|
||||
|
||||
def create
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
if @domain.nameservers.create(nameserver_params)
|
||||
redirect_to [:admin, @domain]
|
||||
else
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def nameserver_params
|
||||
params.require(:nameserver).permit(:hostname, :ipv4, :ipv6)
|
||||
end
|
||||
end
|
|
@ -1,7 +1,5 @@
|
|||
class Admin::RegistrarsController < ApplicationController
|
||||
def search
|
||||
r = Registrar.arel_table
|
||||
query_string = "%#{params[:query]}%"
|
||||
render json: Registrar.where(r[:name].matches(query_string)).pluck(:name)
|
||||
render json: Registrar.search_by_query(params[:query])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue