mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 01:11:43 +02:00
Merge pull request #888 from internetee/improve-registrant-area
Improve registrant area
This commit is contained in:
commit
ea3f3ac43a
21 changed files with 228 additions and 199 deletions
|
@ -52,10 +52,5 @@ body > .container
|
|||
.text-grey
|
||||
color: grey
|
||||
|
||||
.partially-hidden
|
||||
border: 1px solid #dddddd
|
||||
padding-left: 4px
|
||||
padding-right: 4px
|
||||
|
||||
.disabled-value
|
||||
padding-top: 8px
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
class Registrant::ContactsController < RegistrantController
|
||||
helper_method :domain_ids
|
||||
|
||||
def show
|
||||
@contact = Contact.where(id: contacts).find_by(id: params[:id])
|
||||
@contact = Contact.where(id: contacts).find_by(id: params[:id])
|
||||
@current_user = current_user
|
||||
|
||||
authorize! :read, @contact
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def contacts
|
||||
begin
|
||||
DomainContact.where(domain_id: domain_ids).pluck(:contact_id) | Domain.where(id: domain_ids).pluck(:registrant_id)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
class Registrant::RegistrarsController < RegistrantController
|
||||
|
||||
def show
|
||||
@registrar = Registrar.find(params[:id])
|
||||
authorize! :read, @registrar
|
||||
end
|
||||
end
|
||||
end
|
|
@ -447,31 +447,6 @@ class Contact < ActiveRecord::Base
|
|||
domains
|
||||
end
|
||||
|
||||
def all_registrant_domains(page: nil, per: nil, params: {}, registrant: nil)
|
||||
|
||||
if registrant
|
||||
sorts = params.fetch(:sort, {}).first || []
|
||||
sort = Domain.column_names.include?(sorts.first) ? sorts.first : "valid_to"
|
||||
order = {"asc"=>"desc", "desc"=>"asc"}[sorts.second] || "desc"
|
||||
|
||||
domain_ids = DomainContact.distinct.where(contact_id: registrant.id).pluck(:domain_id)
|
||||
|
||||
domains = Domain.where(id: domain_ids).includes(:registrar).page(page).per(per)
|
||||
if sorts.first == "registrar_name".freeze
|
||||
domains = domains.includes(:registrar).where.not(registrars: {id: nil}).order("registrars.name #{order} NULLS LAST")
|
||||
else
|
||||
domains = domains.order("#{sort} #{order} NULLS LAST")
|
||||
end
|
||||
|
||||
domain_c = Hash.new([])
|
||||
registrant_domains.where(id: domains.map(&:id)).each{|d| domain_c[d.id] |= ["Registrant".freeze] }
|
||||
DomainContact.where(contact_id: id, domain_id: domains.map(&:id)).each{|d| domain_c[d.domain_id] |= [d.type] }
|
||||
domains.each{|d| d.roles = domain_c[d.id].uniq}
|
||||
domains
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def update_prohibited?
|
||||
(statuses & [
|
||||
CLIENT_UPDATE_PROHIBITED,
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
%dt= t(:id)
|
||||
%dd= @contact.code
|
||||
|
||||
%dt= t(:authinfo_pw)
|
||||
%dt= Contact.human_attribute_name :auth_info
|
||||
%dd
|
||||
= text_field_tag :auth_info, @contact.auth_info, readonly: true, class: 'partially-hidden'
|
||||
= tag :input, type: 'text', value: @contact.auth_info, readonly: true,
|
||||
class: 'form-control input-sm'
|
||||
|
||||
%br
|
||||
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
.panel.panel-default
|
||||
.panel-heading
|
||||
%h3.panel-title= t(:address)
|
||||
.panel-body
|
||||
%dl.dl-horizontal
|
||||
- if @contact.org_name.present?
|
||||
%dt= t(:org_name)
|
||||
%dd= @contact.org_name
|
||||
|
||||
%dt= t(:street)
|
||||
%dd= @contact.street
|
||||
|
||||
%dt= t(:city)
|
||||
%dd= @contact.city
|
||||
|
||||
%dt= t(:zip)
|
||||
%dd= @contact.zip
|
||||
|
||||
%dt= t(:state)
|
||||
%dd= @contact.state
|
||||
|
||||
%dt= t(:country)
|
||||
%dd= @contact.country
|
|
@ -1,30 +0,0 @@
|
|||
- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params.merge(leave_domains: domain_ids))
|
||||
#contacts.panel.panel-default
|
||||
.panel-heading
|
||||
.pull-left
|
||||
= t(:domains)
|
||||
.pull-right
|
||||
= form_tag request.path, method: :get do
|
||||
= select_tag :domain_filter, options_for_select(%w(Registrant AdminDomainContact TechDomainContact), selected: params[:domain_filter]),
|
||||
include_blank: true, class: 'form-control2 selectize2'
|
||||
%button.btn.btn-primary
|
||||
%span.glyphicon.glyphicon-search
|
||||
.clearfix
|
||||
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-3'}=custom_sort_link t(:domain_name), :name
|
||||
%th{class: 'col-xs-3'}=custom_sort_link t(:registrar_name), :registrar_name
|
||||
%th{class: 'col-xs-3'}=custom_sort_link t(:valid_to), :valid_to
|
||||
%th{class: 'col-xs-3'}=custom_sort_link Domain.human_attribute_name(:roles), :roles
|
||||
%tbody
|
||||
- domains.each do |x|
|
||||
%tr
|
||||
%td= link_to(x.name, [:registrant, x])
|
||||
%td= link_to(x.registrar, [:registrant, x.registrar])
|
||||
%td= l(x.valid_to, format: :short)
|
||||
%td= x.roles.join(", ")
|
||||
|
||||
= paginate domains, param_name: :domain_page
|
|
@ -1,48 +0,0 @@
|
|||
.panel.panel-default
|
||||
.panel-heading
|
||||
%h3.panel-title= t(:general)
|
||||
.panel-body
|
||||
%dl.dl-horizontal
|
||||
%dt= t(:id)
|
||||
%dd= @contact.code
|
||||
|
||||
%dt= t(:name)
|
||||
%dd= @contact.name
|
||||
|
||||
%dt= t(:password)
|
||||
%dd
|
||||
= text_field_tag :auth_info, @contact.auth_info, readonly: true, class: 'partially-hidden'
|
||||
|
||||
%br
|
||||
|
||||
%dt= t(:ident)
|
||||
%dd= ident_for(@contact)
|
||||
|
||||
%dt= t(:email)
|
||||
%dd= @contact.email
|
||||
|
||||
%dt= t(:phone)
|
||||
%dd= @contact.phone
|
||||
|
||||
- if @contact.fax
|
||||
%dt= t(:fax)
|
||||
%dd= @contact.fax
|
||||
|
||||
%br
|
||||
|
||||
%dt= Contact.human_attribute_name :created_at
|
||||
%dd
|
||||
= l(@contact.created_at, format: :short)
|
||||
by
|
||||
= @contact.name
|
||||
|
||||
%dt= Contact.human_attribute_name :updated_at
|
||||
%dd
|
||||
= l(@contact.updated_at, format: :short)
|
||||
by
|
||||
= @contact.name
|
||||
|
||||
%dt= t(:registrar_name)
|
||||
%dd
|
||||
- if @contact.registrar.present?
|
||||
= link_to(@contact.registrar, registrant_registrar_path(@contact.registrar))
|
|
@ -1,6 +0,0 @@
|
|||
= search_form_for [:registrant, @q] do |f|
|
||||
= f.search_field :name_cont
|
||||
= f.submit do
|
||||
%span.glyphicon.glyphicon-search
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
- panel_class = contact.errors.messages[:statuses] ? 'panel-danger' : 'panel-default'
|
||||
#contact_statuses.panel{class: panel_class}
|
||||
.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
|
||||
- contact.statuses.each do |status|
|
||||
%tr
|
||||
%td= status
|
||||
%td= contact.status_notes[status]
|
||||
|
||||
- if contact.errors.messages[:statuses]
|
||||
%tfoot
|
||||
- @domain.errors.messages[:statuses].each do |s|
|
||||
%tr
|
||||
%td{colspan: 4}= s
|
|
@ -1,11 +0,0 @@
|
|||
= render 'shared/title', name: @contact.name
|
||||
|
||||
.row
|
||||
.col-md-6= render 'registrant/contacts/partials/general'
|
||||
.col-md-6= render 'registrant/contacts/partials/address'
|
||||
.row
|
||||
.col-md-12= render 'registrant/contacts/partials/statuses', contact: @contact
|
||||
.row
|
||||
.col-md-12= render 'registrant/contacts/partials/domains', contact: @contact
|
||||
|
||||
|
25
app/views/registrant/contacts/show.html.erb
Normal file
25
app/views/registrant/contacts/show.html.erb
Normal file
|
@ -0,0 +1,25 @@
|
|||
<div class="page-header">
|
||||
<h1><%= @contact.name %></h1>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<%= render 'registrant/contacts/show/general' %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<%= render 'registrant/contacts/show/address' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= render 'registrant/contacts/show/statuses', contact: @contact %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= render 'registrant/contacts/show/domains', contact: @contact %>
|
||||
</div>
|
||||
</div>
|
31
app/views/registrant/contacts/show/_address.html.erb
Normal file
31
app/views/registrant/contacts/show/_address.html.erb
Normal file
|
@ -0,0 +1,31 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<%= t '.header' %>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<% if @contact.org_name.present? %>
|
||||
<dt><%= Contact.human_attribute_name :org_name %></dt>
|
||||
<dd><%= @contact.org_name %></dd>
|
||||
<% end %>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :street %></dt>
|
||||
<dd><%= @contact.street %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :city %></dt>
|
||||
<dd><%= @contact.city %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :zip %></dt>
|
||||
<dd><%= @contact.zip %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :state %></dt>
|
||||
<dd><%= @contact.state %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :country %></dt>
|
||||
<dd><%= @contact.country %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
6
app/views/registrant/contacts/show/_domain.html.erb
Normal file
6
app/views/registrant/contacts/show/_domain.html.erb
Normal file
|
@ -0,0 +1,6 @@
|
|||
<tr>
|
||||
<td><%= link_to domain.name, registrant_domain_path(domain) %></td>
|
||||
<td><%= link_to domain.registrar, registrant_registrar_path(domain.registrar) %></td>
|
||||
<td><%= l domain.valid_to %></td>
|
||||
<td><%= domain.roles.join(", ") %></td>
|
||||
</tr>
|
54
app/views/registrant/contacts/show/_domains.html.erb
Normal file
54
app/views/registrant/contacts/show/_domains.html.erb
Normal file
|
@ -0,0 +1,54 @@
|
|||
<% domains = contact.all_domains(page: params[:domain_page], per: 20, params:
|
||||
params.merge(leave_domains: domain_ids)) %>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<%= t '.header' %>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 text-right">
|
||||
<%= form_tag request.path, method: :get, class: 'form-inline' do %>
|
||||
<%= select_tag :domain_filter,
|
||||
options_for_select(%w(Registrant AdminDomainContact TechDomainContact),
|
||||
selected: params[:domain_filter]),
|
||||
include_blank: t('.all'),
|
||||
class: 'form-control' %>
|
||||
<button class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
</button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-3">
|
||||
<%= custom_sort_link Domain.human_attribute_name(:name), :name %>
|
||||
</th>
|
||||
<th class="col-xs-3">
|
||||
<%= custom_sort_link Registrar.model_name.human, :registrar_name %>
|
||||
</th>
|
||||
<th class="col-xs-3">
|
||||
<%= custom_sort_link Domain.human_attribute_name(:valid_to), :valid_to %>
|
||||
</th>
|
||||
<th class="col-xs-3">
|
||||
<%= custom_sort_link Domain.human_attribute_name(:roles), :roles %>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<%= render partial: 'registrant/contacts/show/domain', collection: domains %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="panel-footer">
|
||||
<%= paginate domains, param_name: :domain_page %>
|
||||
</div>
|
||||
</div>
|
48
app/views/registrant/contacts/show/_general.html.erb
Normal file
48
app/views/registrant/contacts/show/_general.html.erb
Normal file
|
@ -0,0 +1,48 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<%= t '.header' %>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt><%= Contact.human_attribute_name :code %></dt>
|
||||
<dd><%= @contact.code %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :name %></dt>
|
||||
<dd><%= @contact.name %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :auth_info %></dt>
|
||||
<dd>
|
||||
<%= tag :input, type: 'text', value: @contact.auth_info, readonly: true,
|
||||
class: 'form-control input-sm' %>
|
||||
</dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :ident %></dt>
|
||||
<dd><%= ident_for(@contact) %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :email %></dt>
|
||||
<dd><%= @contact.email %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :phone %></dt>
|
||||
<dd><%= @contact.phone %></dd>
|
||||
|
||||
<% if @contact.fax %>
|
||||
<dt><%= Contact.human_attribute_name :fax %></dt>
|
||||
<dd><%= @contact.fax %></dd>
|
||||
<% end %>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :created_at %></dt>
|
||||
<dd><%= l @contact.created_at %></dd>
|
||||
|
||||
<dt><%= Contact.human_attribute_name :updated_at %></dt>
|
||||
<dd><%= l @contact.updated_at %></dd>
|
||||
|
||||
<dt><%= Registrar.model_name.human %></dt>
|
||||
<dd>
|
||||
<%= link_to @contact.registrar, registrant_registrar_path(@contact.registrar) %>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
6
app/views/registrant/contacts/show/_search.html.erb
Normal file
6
app/views/registrant/contacts/show/_search.html.erb
Normal file
|
@ -0,0 +1,6 @@
|
|||
<%= search_form_for [:registrant, @q] do |f| %>
|
||||
<%= f.search_field :name_cont %>
|
||||
<%= f.submit do %>
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
<% end %>
|
||||
<% end %>
|
25
app/views/registrant/contacts/show/_statuses.html.erb
Normal file
25
app/views/registrant/contacts/show/_statuses.html.erb
Normal file
|
@ -0,0 +1,25 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<%= t '.header' %>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-6"><%= t '.status' %></th>
|
||||
<th class="col-xs-6"><%= t '.notes' %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% contact.statuses.each do |status| %>
|
||||
<tr>
|
||||
<td><%= status %></td>
|
||||
<td><%= contact.status_notes[status] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
|
@ -6,9 +6,10 @@
|
|||
%dt= t(:id)
|
||||
%dd= @contact.id
|
||||
|
||||
%dt= t(:authinfo_pw)
|
||||
%dt= Contact.human_attribute_name :auth_info
|
||||
%dd
|
||||
= text_field_tag :password, @contact.password, readonly: true, class: 'partially-hidden'
|
||||
= tag :input, type: 'text', value: @contact.password, readonly: true,
|
||||
class: 'form-control input-sm'
|
||||
|
||||
%br
|
||||
|
||||
|
|
18
config/locales/registrant/contacts.en.yml
Normal file
18
config/locales/registrant/contacts.en.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
en:
|
||||
registrant:
|
||||
contacts:
|
||||
show:
|
||||
general:
|
||||
header: General
|
||||
|
||||
address:
|
||||
header: Address
|
||||
|
||||
statuses:
|
||||
header: Statuses
|
||||
status: Status
|
||||
notes: Note
|
||||
|
||||
domains:
|
||||
header: Domains
|
||||
all: All roles
|
|
@ -101,6 +101,8 @@ Rails.application.routes.draw do
|
|||
namespace :registrant do
|
||||
root 'domains#index'
|
||||
|
||||
resources :registrars, only: :show
|
||||
resources :contacts, only: :show
|
||||
resources :domains, only: %i[index show] do
|
||||
collection do
|
||||
get :download_list
|
||||
|
@ -111,8 +113,8 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :domain_update_confirms
|
||||
resources :domain_delete_confirms
|
||||
resources :domain_update_confirms, only: %i[show update]
|
||||
resources :domain_delete_confirms, only: %i[show update]
|
||||
|
||||
devise_scope :user do
|
||||
get 'login' => 'sessions#login'
|
||||
|
@ -125,29 +127,8 @@ Rails.application.routes.draw do
|
|||
post 'id' => 'sessions#id'
|
||||
get 'logout' => '/devise/sessions#destroy'
|
||||
end
|
||||
|
||||
resources :domains do
|
||||
resources :registrant_verifications
|
||||
collection do
|
||||
post 'update', as: 'update'
|
||||
post 'destroy', as: 'destroy'
|
||||
get 'renew'
|
||||
get 'edit'
|
||||
get 'info'
|
||||
get 'delete'
|
||||
end
|
||||
end
|
||||
|
||||
resources :registrars do
|
||||
collection do
|
||||
get :search
|
||||
end
|
||||
end
|
||||
|
||||
resources :contacts
|
||||
end
|
||||
|
||||
|
||||
# ADMIN ROUTES
|
||||
namespace :admin do
|
||||
resources :keyrelays
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue