From 638167e3cb90a0276630cf02133841e237a342d6 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Fri, 3 Aug 2018 22:35:53 +0300 Subject: [PATCH] Improve registrant area --- .../stylesheets/registrant/registrant.sass | 4 +- .../registrant/contacts_controller.rb | 5 +++ app/views/registrant/contacts/show.html.erb | 6 +++ app/views/registrant/domains/_domain.html.erb | 5 ++- .../domains/partials/_admin_contacts.haml | 22 ---------- .../domains/partials/_contacts.html.erb | 40 +++++++++++++++++++ .../registrant/domains/partials/_owner.haml | 19 --------- .../domains/partials/_registrant.html.erb | 28 +++++++++++++ .../domains/partials/_tech_contacts.haml | 22 ---------- app/views/registrant/domains/show.html.erb | 24 +++++++++-- config/locales/contacts.en.yml | 3 ++ config/locales/registrant/contacts.en.yml | 2 + config/locales/registrant/domains.en.yml | 16 ++++---- config/routes.rb | 3 +- 14 files changed, 119 insertions(+), 80 deletions(-) delete mode 100644 app/views/registrant/domains/partials/_admin_contacts.haml create mode 100644 app/views/registrant/domains/partials/_contacts.html.erb delete mode 100644 app/views/registrant/domains/partials/_owner.haml create mode 100644 app/views/registrant/domains/partials/_registrant.html.erb delete mode 100644 app/views/registrant/domains/partials/_tech_contacts.haml diff --git a/app/assets/stylesheets/registrant/registrant.sass b/app/assets/stylesheets/registrant/registrant.sass index 6937c4b49..ebe9f4974 100644 --- a/app/assets/stylesheets/registrant/registrant.sass +++ b/app/assets/stylesheets/registrant/registrant.sass @@ -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 diff --git a/app/controllers/registrant/contacts_controller.rb b/app/controllers/registrant/contacts_controller.rb index 267b4d68d..4d0bed4d7 100644 --- a/app/controllers/registrant/contacts_controller.rb +++ b/app/controllers/registrant/contacts_controller.rb @@ -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 diff --git a/app/views/registrant/contacts/show.html.erb b/app/views/registrant/contacts/show.html.erb index 6d08feccc..f9a8a86fa 100644 --- a/app/views/registrant/contacts/show.html.erb +++ b/app/views/registrant/contacts/show.html.erb @@ -1,3 +1,9 @@ + + diff --git a/app/views/registrant/domains/_domain.html.erb b/app/views/registrant/domains/_domain.html.erb index b3bf4d334..7228c9399 100644 --- a/app/views/registrant/domains/_domain.html.erb +++ b/app/views/registrant/domains/_domain.html.erb @@ -1,6 +1,9 @@ <%= link_to domain, registrant_domain_path(domain) %> - <%= link_to domain.registrant.name, registrant_contact_path(domain.registrant) %> + + <%= link_to domain.registrant.name, + registrant_domain_contact_path(domain, domain.registrant) %> + <%= l domain.expire_time %> <%= link_to domain.registrar, registrant_registrar_path(domain.registrar) %> diff --git a/app/views/registrant/domains/partials/_admin_contacts.haml b/app/views/registrant/domains/partials/_admin_contacts.haml deleted file mode 100644 index 5ee50c31d..000000000 --- a/app/views/registrant/domains/partials/_admin_contacts.haml +++ /dev/null @@ -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 diff --git a/app/views/registrant/domains/partials/_contacts.html.erb b/app/views/registrant/domains/partials/_contacts.html.erb new file mode 100644 index 000000000..c66d364c3 --- /dev/null +++ b/app/views/registrant/domains/partials/_contacts.html.erb @@ -0,0 +1,40 @@ +<% panel_class = errors ? 'panel-danger' : 'panel-default' %> +
+
+ <%= header %> +
+ +
+ + + + + + + + + + + <% contacts.each do |contact| %> + + + + + + <% end %> + + + <% if errors %> + + <% errors.each do |error| %> + + + + <% end %> + + <% end %> +
<%= Contact.human_attribute_name :name %><%= Contact.human_attribute_name :code %><%= Contact.human_attribute_name :email %>
+ <%= link_to contact, registrant_domain_contact_path(domain, contact) %> + <%= contact.code %><%= contact.email %>
<%= error %>
+
+
\ No newline at end of file diff --git a/app/views/registrant/domains/partials/_owner.haml b/app/views/registrant/domains/partials/_owner.haml deleted file mode 100644 index 01bfa9ea9..000000000 --- a/app/views/registrant/domains/partials/_owner.haml +++ /dev/null @@ -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 diff --git a/app/views/registrant/domains/partials/_registrant.html.erb b/app/views/registrant/domains/partials/_registrant.html.erb new file mode 100644 index 000000000..67e0c91a4 --- /dev/null +++ b/app/views/registrant/domains/partials/_registrant.html.erb @@ -0,0 +1,28 @@ +
+
+ <%= t '.header' %> +
+ +
+
+
<%= Registrant.human_attribute_name :name %>
+
<%= registrant.name %>
+ +
<%= Registrant.human_attribute_name :code %>
+
<%= registrant.code %>
+ +
<%= Registrant.human_attribute_name :ident %>
+
<%= registrant.ident %>
+ +
<%= Registrant.human_attribute_name :email %>
+
<%= registrant.email %>
+ +
<%= Registrant.human_attribute_name :phone %>
+
<%= registrant.phone %>
+
+
+ + +
\ No newline at end of file diff --git a/app/views/registrant/domains/partials/_tech_contacts.haml b/app/views/registrant/domains/partials/_tech_contacts.haml deleted file mode 100644 index c1177ae4b..000000000 --- a/app/views/registrant/domains/partials/_tech_contacts.haml +++ /dev/null @@ -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 diff --git a/app/views/registrant/domains/show.html.erb b/app/views/registrant/domains/show.html.erb index 32dc2584a..fdbbc76cb 100644 --- a/app/views/registrant/domains/show.html.erb +++ b/app/views/registrant/domains/show.html.erb @@ -1,23 +1,39 @@ -<%= render 'shared/title', name: @domain.name %> + + +
<%= render 'registrant/domains/partials/general' %>
+
- <%= render 'registrant/domains/partials/owner' %> + <%= render partial: 'registrant/domains/partials/registrant', + locals: { registrant: @domain.registrant, domain: @domain } %>
- <%= 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] %>
- <%= 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] %>
diff --git a/config/locales/contacts.en.yml b/config/locales/contacts.en.yml index 47589039b..13ab05f0f 100644 --- a/config/locales/contacts.en.yml +++ b/config/locales/contacts.en.yml @@ -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: diff --git a/config/locales/registrant/contacts.en.yml b/config/locales/registrant/contacts.en.yml index ef6ea173f..a44755832 100644 --- a/config/locales/registrant/contacts.en.yml +++ b/config/locales/registrant/contacts.en.yml @@ -1,6 +1,8 @@ en: registrant: contacts: + contact_index: Contacts + show: general: header: General diff --git a/config/locales/registrant/domains.en.yml b/config/locales/registrant/domains.en.yml index be0a1c638..ebb3d2aec 100644 --- a/config/locales/registrant/domains.en.yml +++ b/config/locales/registrant/domains.en.yml @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 6af6623f8..9dd854ab3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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