105842700-portal

This commit is contained in:
Stas 2015-12-01 15:21:40 +02:00
parent 360fb57a68
commit 6077f6c36d
16 changed files with 378 additions and 16 deletions

View file

@ -1,5 +1,41 @@
class Registrant::DomainsController < RegistrantController class Registrant::DomainsController < RegistrantController
def index def index
authorize! :view, :registrant_domains
authorize! :view, :registrant_domains
params[:q] ||= {}
domains = Domain.includes(:registrar, :registrant).where(registrant_id: 76246)
normalize_search_parameters do
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
end end
end @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
end
def show
@domain = Domain.find(params[:id])
@domain.valid?
end
def set_domain
@domain = Domain.find(params[:id])
end
def normalize_search_parameters
ca_cache = params[:q][:valid_to_lteq]
begin
end_time = params[:q][:valid_to_lteq].try(:to_date)
params[:q][:valid_to_lteq] = end_time.try(:end_of_day)
rescue
logger.warn('Invalid date')
end
yield
params[:q][:valid_to_lteq] = ca_cache
end
end

View file

@ -0,0 +1,64 @@
class Registrar::RegistrarsController < RegistrartController
load_and_authorize_resource
def search
render json: Registrar.search_by_query(params[:q])
end
def index
@q = Registrar.ordered.search(params[:q])
@registrars = @q.result.page(params[:page])
end
def new
@registrar = Registrar.new
end
def create
@registrar = Registrar.new(registrar_params)
if @registrar.save
flash[:notice] = I18n.t('registrar_added')
redirect_to [:admin, @registrar]
else
flash.now[:alert] = I18n.t('failed_to_add_registrar')
render 'new'
end
end
def edit; end
def update
if @registrar.update(registrar_params)
flash[:notice] = I18n.t('registrar_updated')
redirect_to [:admin, @registrar]
else
flash.now[:alert] = I18n.t('failed_to_update_registrar')
render 'edit'
end
end
def destroy
if @registrar.destroy
flash[:notice] = I18n.t('registrar_deleted')
redirect_to admin_registrars_path
else
flash.now[:alert] = I18n.t('failed_to_delete_registrar')
render 'show'
end
end
private
def set_registrar
@registrar = Registrar.find(params[:id])
end
def registrar_params
params.require(:registrar).permit(
:name, :reg_no, :vat_no, :street, :city, :state, :zip, :billing_address,
:country_code, :email, :phone, :billing_email, :code
)
end
end

View file

@ -2,6 +2,8 @@ class Registrant::SessionsController < Devise::SessionsController
layout 'registrant/application' layout 'registrant/application'
def login def login
@user = RegistrantUser.find_by_username('registrar1')
sign_in(@user, event: :authentication)
end end
# rubocop: disable Metrics/AbcSize # rubocop: disable Metrics/AbcSize

View file

@ -1,5 +1,9 @@
class Registrant::WhoisController < RegistrantController class Registrant::WhoisController < RegistrantController
def index def index
authorize! :view, :registrant_whois authorize! :view, :registrant_whois
if params[:domain_name].present?
@domain = WhoisRecord.find_by(name: params[:domain_name]);
end
end end
end end

View file

@ -1,5 +1,42 @@
= render 'shared/title', name: t(:domains) = render 'shared/title', name: t(:domains)
.row
.col-md-12
= search_form_for [:registrant, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
.row
.col-md-3
.form-group
= f.label :name
= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
.col-md-3
.form-group
= f.label t(:registrant_ident)
= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident)
.col-md-3
.form-group
= f.label t(:nameserver_hostname)
= f.search_field :nameservers_hostname_eq, class: 'form-control', placeholder: t(:nameserver_hostname)
.row
.col-md-3
.form-group
= f.label t(:valid_to_from)
= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control datepicker', placeholder: t(:valid_to_from)
.col-md-3
.form-group
= f.label t(:valid_to_until)
= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control datepicker', placeholder: t(:valid_to_until)
.col-md-3
.form-group
= label_tag t(:results_per_page)
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
.col-md-3{style: 'padding-top: 25px;'}
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
%hr %hr
.row .row
.col-md-12 .col-md-12
@ -8,20 +45,20 @@
%thead %thead
%tr %tr
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= t(:name) = sort_link(@q, 'name')
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= t(:registrant) = sort_link(@q, 'registrant_name', t(:registrant))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= t(:valid_to) = sort_link(@q, 'valid_to', t(:valid_to))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= t(:registrar) = sort_link(@q, 'registrar_name', t(:registrar))
%tbody %tbody
-# - @domains.each do |x| - @domains.each do |x|
-# %tr %tr
-# %td= link_to(x, admin_domain_path(x)) %td= link_to(x, registrant_domain_path(x))
-# %td %td
-# - if x.registrant - if x.registrant
-# = link_to(x.registrant, [:admin, x.registrant]) = link_to(x.registrant, [:admin, x.registrant])
-# %td= l(x.valid_to, format: :short) %td= l(x.valid_to, format: :short)
-# %td= link_to(x.registrar, admin_registrar_path(x.registrar)) if x.registrar %td= link_to(x.registrar, admin_registrar_path(x.registrar)) if x.registrar

View file

@ -0,0 +1,22 @@
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
.panel{class: panel_class}
.panel-heading.clearfix
= t(:admin_contacts)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:name)
%th{class: 'col-xs-4'}= t(:id)
%th{class: 'col-xs-4'}= t(:email)
%tbody
- @domain.admin_contacts.each do |ac|
%tr
%td= link_to(ac, admin_contact_path(ac))
%td= ac.code
%td= ac.email
- if @domain.errors.messages[:admin_contacts]
%tfoot
- @domain.errors.messages[:admin_contacts].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -0,0 +1,25 @@
- panel_class = @domain.errors.messages[:dnskeys] ? 'panel-danger' : 'panel-default'
#dnskeys.panel{class: panel_class}
.panel-heading.clearfix
= t(:dnskeys)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-1'}= t(:flag)
%th{class: 'col-xs-1'}= t(:protocol)
%th{class: 'col-xs-1'}= t(:algorithm)
%th{class: 'col-xs-9'}= t(:public_key)
%tbody
- @domain.dnskeys.each do |x|
%tr
%td= x.flags
%td= x.protocol
%td= x.alg
%td= x.public_key
- if @domain.errors.messages[:dnskeys]
%tfoot
- @domain.errors.messages[:dnskeys].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -0,0 +1,32 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t(:general)
.panel-body
%dl.dl-horizontal
%dt= t(:name)
%dd= @domain.name
%dt= t(:registered_at)
%dd= l(@domain.registered_at)
%dt= t(:registrar)
%dd= link_to(@domain.registrar, admin_registrar_path(@domain.registrar))
%dt= t(:password)
%dd
= text_field_tag :password, @domain.auth_info, readonly: true, class: 'partially-hidden'
%dt= t(:valid_from)
%dd= l(@domain.valid_from)
%dt= t(:valid_to)
%dd= l(@domain.valid_to)
%dt= t(:outzone_at)
%dd= l(@domain.outzone_at)
%dt= t(:delete_at)
%dd= l(@domain.delete_at)
%dt= t(:force_delete_at)
%dd= l(@domain.force_delete_at)

View file

@ -0,0 +1,20 @@
.panel{class: 'panel-default'}
.panel-heading.clearfix
= t(:keyrelays)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:uploaded_at)
%th{class: 'col-xs-3'}= t(:expiry)
%th{class: 'col-xs-2'}= t(:requester)
%th{class: 'col-xs-2'}= t(:accepter)
%th{class: 'col-xs-1'}= t(:status)
%tbody
- @domain.keyrelays.includes([:requester, :accepter]).order(pa_date: :desc).each do |x|
%tr
%td= link_to(x.pa_date, [:admin, x])
%td= x.expiry
%td= link_to(x.requester, [:admin, x.requester])
%td= link_to(x.accepter, [:admin, x.accepter])
%td= x.status

View file

@ -0,0 +1,14 @@
.panel.panel-default
.panel-heading.clearfix
= t(:legal_documents)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-8'}= t(:created_at)
%th{class: 'col-xs-4'}= t(:type)
%tbody
- legal_documents.each do |x|
%tr
%td= link_to(x.created_at, [:admin, x])
%td= x.document_type

View file

@ -0,0 +1,23 @@
- panel_class = @domain.errors.messages[:nameservers] ? 'panel-danger' : 'panel-default'
#nameservers.panel{class: panel_class}
.panel-heading.clearfix
= t(:nameservers)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:hostname)
%th{class: 'col-xs-4'}= t(:ipv4)
%th{class: 'col-xs-4'}= t(:ipv6)
%tbody
- @domain.nameservers.each do |x|
%tr
%td= x
%td= x.ipv4
%td= x.ipv6
- if @domain.errors.messages[:nameservers]
%tfoot
- @domain.errors.messages[:nameservers].each do |x|
%tr
%td{colspan: 3}= x

View file

@ -0,0 +1,19 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t(:registrant)
.panel-body
%dl.dl-horizontal
%dt= t(:name)
%dd= link_to(@domain.registrant, [:admin, @domain.registrant])
%dt= t(:id)
%dd= @domain.registrant_code
%dt= t(:identity_code)
%dd= @domain.registrant_ident
%dt= t(:email)
%dd= @domain.registrant_email
%dt= t(:phone)
%dd= @domain.registrant_phone

View file

@ -0,0 +1,18 @@
#domain_statuses.panel.panel-default
.panel-heading.clearfix
= t(:statuses)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}= t(:status)
%th{class: 'col-xs-6'}= t(:notes)
%tbody
- @domain.statuses.each do |status|
%tr
%td
- if @domain.pending_json.present? && [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE].include?(status)
= link_to status, admin_domain_domain_versions_path(@domain.id)
- else
= status
%td= @domain.status_notes[status]

View file

@ -0,0 +1,22 @@
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
#tech_contacts.panel{class: panel_class}
.panel-heading.clearfix
= t(:tech_contacts)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:name)
%th{class: 'col-xs-4'}= t(:id)
%th{class: 'col-xs-4'}= t(:email)
%tbody
- @domain.tech_contacts.each do |tc|
%tr
%td= link_to(tc, admin_contact_path(tc))
%td= tc.code
%td= tc.email
- if @domain.errors.messages[:tech_contacts]
%tfoot
- @domain.errors.messages[:tech_contacts].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -0,0 +1,24 @@
- content_for :actions do
= link_to(t(:edit_statuses), edit_admin_domain_path(@domain), class: 'btn btn-primary')
= link_to(t(:history), admin_domain_domain_versions_path(@domain.id), method: :get, class: 'btn btn-primary')
= render 'shared/title', name: @domain.name
.row
.col-md-6= render 'admin/domains/partials/general'
.col-md-6= render 'admin/domains/partials/owner'
.row
.col-md-12= render 'admin/domains/partials/tech_contacts'
.row
.col-md-12= render 'admin/domains/partials/admin_contacts'
.row
.col-md-12= render 'admin/domains/partials/statuses'
.row
.col-md-12= render 'admin/domains/partials/nameservers'
.row
.col-md-12= render 'admin/domains/partials/dnskeys'
.row
.col-md-12= render 'admin/domains/partials/keyrelays'
.row
.col-md-12
= render 'admin/domains/partials/legal_documents', legal_documents: @domain.legal_documents

View file

@ -17,5 +17,5 @@
%span.glyphicon.glyphicon-search %span.glyphicon.glyphicon-search
&nbsp; &nbsp;
%hr %hr
- if @results - if @domain
= @results %pre= @domain.body