Domain list for admin

This commit is contained in:
Martin Lensment 2014-09-05 12:16:02 +03:00
parent 238be6d59e
commit 8531e50474
11 changed files with 81 additions and 7 deletions

View file

@ -0,0 +1,5 @@
class Admin::DomainsController < ApplicationController
def index
@domains = Domain.all
end
end

View file

@ -83,7 +83,8 @@ module Epp::DomainsHelper
## CREATE
def validate_domain_create_request
@ph = params_hash['epp']['command']['create']['create']
xml_attrs_present?(@ph, [['name'], ['ns'], ['contact'], ['registrant']])
# TODO: Verify contact presence if registrant is juridical
xml_attrs_present?(@ph, [['name'], ['ns'], ['registrant']])
end
def domain_create_params

View file

@ -113,6 +113,10 @@ class Contact < ActiveRecord::Base
}
end
def to_s
name
end
class << self
def extract_attributes(ph, type = :create)
contact_hash = {

View file

@ -327,6 +327,10 @@ class Domain < ActiveRecord::Base
## SHARED
def to_s
name
end
def generate_auth_info
begin
self.auth_info = SecureRandom.hex

View file

@ -3,4 +3,8 @@ class Registrar < ActiveRecord::Base
has_many :domains
has_many :ns_sets
has_many :epp_users
def to_s
name
end
end

View file

@ -0,0 +1,24 @@
%h2= t('shared.domains')
%hr
.row
.col-md-12
.table-responsive
%table.table.table-striped.table-bordered.table-condensed
%tr
%th{class: 'col-xs-2'}
= t('shared.name')
%th{class: 'col-xs-2'}
= t('shared.registrar')
%th{class: 'col-xs-2'}
= t('shared.owner')
%th{class: 'col-xs-1'}
= t('shared.valid_to')
%th{class: 'col-xs-1'}
= t('shared.action')
- @domains.each do |x|
%tr
%td= link_to(x, admin_domain_path(x))
%td= link_to(x.registrar, root_path) if x.registrar
%td= link_to(x.owner_contact, root_path)
%td= l(x.valid_to, format: :short)
%td= link_to(t('shared.edit'), edit_admin_domain_path(x), class: 'btn btn-primary btn-xs')

View file

@ -28,7 +28,7 @@
%li
= link_to t('shared.registrars'), root_path
%li
= link_to t('shared.domains'), root_path
= link_to t('shared.domains'), admin_domains_path
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
= t('shared.settings')