mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 02:09:39 +02:00
Domain list for admin
This commit is contained in:
parent
238be6d59e
commit
8531e50474
11 changed files with 81 additions and 7 deletions
5
app/controllers/admin/domains_controller.rb
Normal file
5
app/controllers/admin/domains_controller.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class Admin::DomainsController < ApplicationController
|
||||
def index
|
||||
@domains = Domain.all
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
|
@ -113,6 +113,10 @@ class Contact < ActiveRecord::Base
|
|||
}
|
||||
end
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
||||
|
||||
class << self
|
||||
def extract_attributes(ph, type = :create)
|
||||
contact_hash = {
|
||||
|
|
|
@ -327,6 +327,10 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
## SHARED
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
||||
|
||||
def generate_auth_info
|
||||
begin
|
||||
self.auth_info = SecureRandom.hex
|
||||
|
|
|
@ -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
|
||||
|
|
24
app/views/admin/domains/index.haml
Normal file
24
app/views/admin/domains/index.haml
Normal 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')
|
|
@ -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')
|
||||
|
|
|
@ -20,6 +20,17 @@
|
|||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
time:
|
||||
formats:
|
||||
default: "%d. %B %Y, %H:%M"
|
||||
longer: "%a, %e. %b %Y, %H:%M"
|
||||
long: "%A, %e. %B %Y, %H:%M"
|
||||
short: "%d.%m.%y, %H:%M"
|
||||
|
||||
date:
|
||||
formats:
|
||||
year_and_month: "%Y %B"
|
||||
|
||||
activerecord:
|
||||
errors:
|
||||
models:
|
||||
|
@ -127,8 +138,12 @@ en:
|
|||
domains: 'Domains'
|
||||
epp_users: 'EPP Users'
|
||||
registrars: 'Registrars'
|
||||
valid_to: 'Valid to'
|
||||
name: 'Name'
|
||||
|
||||
transfer_can_be_approved_only_by_current_registrar: 'Transfer can be approved only by current domain registrar'
|
||||
edit_settings: 'Edit settings'
|
||||
setting_group: 'Setting group'
|
||||
setting: 'Setting'
|
||||
registrar: 'Registrar'
|
||||
owner: 'Owner'
|
||||
|
|
|
@ -6,6 +6,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
namespace(:admin) do
|
||||
resources :domains
|
||||
resources :setting_groups
|
||||
end
|
||||
|
||||
|
@ -13,7 +14,7 @@ Rails.application.routes.draw do
|
|||
# See how all your routes lay out with "rake routes".
|
||||
|
||||
# You can have the root of your site routed with "root"
|
||||
root 'admin/setting_groups#index'
|
||||
root 'admin/domains#index'
|
||||
|
||||
# Example of regular route:
|
||||
# get 'products/:id' => 'catalog#view'
|
||||
|
|
|
@ -218,10 +218,7 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
response = epp_request(xml, :xml)
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
expect(response[:results][0][:msg]).to eq('Required parameter missing: contact')
|
||||
|
||||
expect(response[:results][1][:result_code]).to eq('2003')
|
||||
expect(response[:results][1][:msg]).to eq('Required parameter missing: registrant')
|
||||
expect(response[:results][0][:msg]).to eq('Required parameter missing: registrant')
|
||||
end
|
||||
|
||||
it 'does not create domain without nameservers' do
|
||||
|
|
19
spec/features/domain_management_spec.rb
Normal file
19
spec/features/domain_management_spec.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Domain management', type: :feature do
|
||||
background do
|
||||
Fabricate(:domain_validation_setting_group)
|
||||
Fabricate.times(4, :domain)
|
||||
end
|
||||
|
||||
scenario 'User sees domains', js: true do
|
||||
visit root_path
|
||||
click_on 'Domains'
|
||||
|
||||
Domain.all.each do |x|
|
||||
expect(page).to have_link(x)
|
||||
expect(page).to have_link(x.registrar)
|
||||
expect(page).to have_link(x.owner_contact)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue