Improve registrant area

This commit is contained in:
Artur Beljajev 2018-08-03 22:35:53 +03:00
parent 43a70863cf
commit 638167e3cb
14 changed files with 119 additions and 80 deletions

View file

@ -1,6 +1,7 @@
html
position: relative
min-height: 100%
overflow-y: scroll
body
padding-bottom: 130px
@ -30,9 +31,6 @@ h1, h2, h3, h4
color: white !important
background-size: 100%
.semifooter
padding: 42px 0 80px 0
.confirmation
padding: 40px 0 20px 0
.column-keys

View file

@ -1,5 +1,6 @@
class Registrant::ContactsController < RegistrantController
helper_method :domain_ids
helper_method :domain
def show
@contact = Contact.where(id: contacts).find_by(id: params[:id])
@ -26,4 +27,8 @@ class Registrant::ContactsController < RegistrantController
BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_domain_ids
end
end
def domain
Domain.find(params[:domain_id])
end
end

View file

@ -1,3 +1,9 @@
<ol class="breadcrumb">
<li><%= link_to t('registrant.domains.index.header'), registrant_domains_path %></li>
<li><%= link_to domain, registrant_domain_path(domain) %></li>
<li><%= t 'registrant.contacts.contact_index' %></li>
</ol>
<div class="page-header">
<h1><%= @contact.name %></h1>
</div>

View file

@ -1,6 +1,9 @@
<tr>
<td><%= link_to domain, registrant_domain_path(domain) %></td>
<td><%= link_to domain.registrant.name, registrant_contact_path(domain.registrant) %></td>
<td>
<%= link_to domain.registrant.name,
registrant_domain_contact_path(domain, domain.registrant) %>
</td>
<td><%= l domain.expire_time %></td>
<td><%= link_to domain.registrar, registrant_registrar_path(domain.registrar) %></td>
</tr>

View file

@ -1,22 +0,0 @@
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
.panel{class: panel_class}
.panel-heading.clearfix
= t('.title')
.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, registrant_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,40 @@
<% panel_class = errors ? 'panel-danger' : 'panel-default' %>
<div class="<%= panel_class %> panel">
<div class="panel-heading">
<%= header %>
</div>
<div class="table-responsive">
<table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th class="col-xs-4"><%= Contact.human_attribute_name :name %></th>
<th class="col-xs-4"><%= Contact.human_attribute_name :code %></th>
<th class="col-xs-4"><%= Contact.human_attribute_name :email %></th>
</tr>
</thead>
<tbody>
<% contacts.each do |contact| %>
<tr>
<td>
<%= link_to contact, registrant_domain_contact_path(domain, contact) %>
</td>
<td><%= contact.code %></td>
<td><%= contact.email %></td>
</tr>
<% end %>
</tbody>
<% if errors %>
<tfoot>
<% errors.each do |error| %>
<tr>
<td colspan="3"><%= error %></td>
</tr>
<% end %>
</tfoot>
<% end %>
</table>
</div>
</div>

View file

@ -1,19 +0,0 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t('.title')
.panel-body
%dl.dl-horizontal
%dt= t(:name)
%dd= link_to(@domain.registrant.name, registrant_contact_path(@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,28 @@
<div class="panel panel-default">
<div class="panel-heading">
<%= t '.header' %>
</div>
<div class="panel-body">
<dl class="dl-horizontal">
<dt><%= Registrant.human_attribute_name :name %></dt>
<dd><%= registrant.name %></dd>
<dt><%= Registrant.human_attribute_name :code %></dt>
<dd><%= registrant.code %></dd>
<dt><%= Registrant.human_attribute_name :ident %></dt>
<dd><%= registrant.ident %></dd>
<dt><%= Registrant.human_attribute_name :email %></dt>
<dd><%= registrant.email %></dd>
<dt><%= Registrant.human_attribute_name :phone %></dt>
<dd><%= registrant.phone %></dd>
</dl>
</div>
<div class="panel-footer text-right">
<%= link_to t('.view_details_btn'), registrant_domain_contact_path(domain, registrant) %>
</div>
</div>

View file

@ -1,22 +0,0 @@
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
#tech_contacts.panel{class: panel_class}
.panel-heading.clearfix
= t('.title')
.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, registrant_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

@ -1,23 +1,39 @@
<%= render 'shared/title', name: @domain.name %>
<ol class="breadcrumb">
<li><%= link_to t('registrant.domains.index.header'), registrant_domains_path %></li>
</ol>
<div class="page-header">
<h1><%= @domain %></h1>
</div>
<div class="row">
<div class="col-md-6">
<%= render 'registrant/domains/partials/general' %>
</div>
<div class="col-md-6">
<%= render 'registrant/domains/partials/owner' %>
<%= render partial: 'registrant/domains/partials/registrant',
locals: { registrant: @domain.registrant, domain: @domain } %>
</div>
</div>
<div class="row">
<div class="col-md-12">
<%= render 'registrant/domains/partials/tech_contacts' %>
<%= render 'registrant/domains/partials/contacts',
header: t('.tech_contacts'),
domain: @domain,
contacts: @domain.tech_contacts,
errors: @domain.errors.messages[:tech_contacts] %>
</div>
</div>
<div class="row">
<div class="col-md-12">
<%= render 'registrant/domains/partials/admin_contacts' %>
<%= render 'registrant/domains/partials/contacts',
header: t('.admin_contacts'),
domain: @domain,
contacts: @domain.admin_contacts,
errors: @domain.errors.messages[:admin_contacts] %>
</div>
</div>

View file

@ -5,6 +5,9 @@ en:
registrant: Registrant
admin_domain_contact: Administrative contact
tech_domain_contact: Technical contact
attributes:
contact:
code: EPP Code
errors:
models:
contact:

View file

@ -1,6 +1,8 @@
en:
registrant:
contacts:
contact_index: Contacts
show:
general:
header: General

View file

@ -8,12 +8,12 @@ en:
download_list:
registrant: Registrant
show:
admin_contacts: Administrative contacts
tech_contacts: Technical contacts
partials:
owner:
title: Registrant
admin_contacts:
title: Admin. contacts
tech_contacts:
title: Tech. contacts
registrant:
header: Registrant
view_details_btn: View details

View file

@ -113,8 +113,9 @@ Rails.application.routes.draw do
root 'domains#index'
resources :registrars, only: :show
resources :contacts, only: :show
resources :domains, only: %i[index show] do
resources :contacts, only: %i[show]
collection do
get :download_list
end