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 9defa8bd6..b2ebad344 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]) @@ -25,4 +26,19 @@ class Registrant::ContactsController < RegistrantController BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_domain_ids end end -end + + def domain + current_user_domains.find(params[:domain_id]) + end + + def current_user_domains + ident_cc, ident = current_registrant_user.registrant_ident.split '-' + begin + BusinessRegistryCache.fetch_associated_domains ident, ident_cc + rescue Soap::Arireg::NotAvailableError => error + flash[:notice] = I18n.t(error.json[:message]) + Rails.logger.fatal("[EXCEPTION] #{error.to_s}") + current_registrant_user.domains + end + end +end \ No newline at end of file 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..8cc8a490b 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/index.html.erb b/app/views/registrant/domains/index.html.erb index 43a9122eb..acb9afcff 100644 --- a/app/views/registrant/domains/index.html.erb +++ b/app/views/registrant/domains/index.html.erb @@ -76,7 +76,7 @@
- +
+ + + + \ No newline at end of file diff --git a/app/views/registrant/domains/partials/_domain_contacts.html.erb b/app/views/registrant/domains/partials/_domain_contacts.html.erb new file mode 100644 index 000000000..3876e2546 --- /dev/null +++ b/app/views/registrant/domains/partials/_domain_contacts.html.erb @@ -0,0 +1,24 @@ +
+
+ <%= t ".header_#{domain_contacts.model_name.plural.underscore}" %> +
+ +
+
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/_domain_contact.html.erb b/app/views/registrant/domains/partials/_domain_contact.html.erb new file mode 100644 index 000000000..e4eaf7115 --- /dev/null +++ b/app/views/registrant/domains/partials/_domain_contact.html.erb @@ -0,0 +1,7 @@ +<% contact = domain_contact.contact %> + +
<%= link_to contact, registrant_domain_contact_path(domain, contact) %><%= contact.code %><%= contact.email %>
+ + + + + + + + + + <%= render partial: 'registrant/domains/partials/domain_contact', + collection: domain_contacts, + locals: { domain: domain } %> + +
<%= Contact.human_attribute_name :name %><%= Contact.human_attribute_name :code %><%= Contact.human_attribute_name :email %>
+
+
\ No newline at end of file diff --git a/app/views/registrant/domains/partials/_general.html.erb b/app/views/registrant/domains/partials/_general.html.erb index 5dff93331..46d55bd85 100644 --- a/app/views/registrant/domains/partials/_general.html.erb +++ b/app/views/registrant/domains/partials/_general.html.erb @@ -13,7 +13,7 @@
<%= t(:registered_at) %>
<%= l(@domain.registered_at) %>
-
<%= t(:registrar_name) %>
+
<%= Registrar.model_name.human %>
<%= link_to(@domain.registrar, registrant_registrar_path(@domain.registrar)) %>
<%= Domain.human_attribute_name :transfer_code %>
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..f02a2eb4e --- /dev/null +++ b/app/views/registrant/domains/partials/_registrant.html.erb @@ -0,0 +1,26 @@ +
+
+ <%= t '.header' %> +
+ +
+
+
<%= Registrant.human_attribute_name :name %>
+
+ <%= link_to registrant.name, registrant_domain_contact_path(domain, registrant) %> +
+ +
<%= 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..d09253b6b 100644 --- a/app/views/registrant/domains/show.html.erb +++ b/app/views/registrant/domains/show.html.erb @@ -1,23 +1,35 @@ -<%= 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/domain_contacts', + domain: @domain, + domain_contacts: @domain.tech_domain_contacts %>
- <%= render 'registrant/domains/partials/admin_contacts' %> + <%= render 'registrant/domains/partials/domain_contacts', + domain: @domain, + domain_contacts: @domain.admin_domain_contacts %>
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..5016f3f4e 100644 --- a/config/locales/registrant/domains.en.yml +++ b/config/locales/registrant/domains.en.yml @@ -8,12 +8,11 @@ en: download_list: registrant: Registrant + partials: - owner: - title: Registrant + registrant: + header: Registrant - admin_contacts: - title: Admin. contacts - - tech_contacts: - title: Tech. contacts + domain_contacts: + header_admin_domain_contacts: Administrative contacts + header_tech_domain_contacts: Technical contacts diff --git a/config/routes.rb b/config/routes.rb index f173ccad4..ff33ec652 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -136,8 +136,9 @@ Rails.application.routes.draw do end 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 diff --git a/test/fixtures/contacts.yml b/test/fixtures/contacts.yml index 06bd2c90e..cdbf81399 100644 --- a/test/fixtures/contacts.yml +++ b/test/fixtures/contacts.yml @@ -9,6 +9,8 @@ john: code: john-001 auth_info: cacb5b uuid: eb2f2766-b44c-4e14-9f16-32ab1a7cb957 + created_at: <%= Time.zone.parse('2010-07-05').to_s(:db) %> + updated_at: <%= Time.zone.parse('2010-07-06').to_s(:db) %> william: &william name: William diff --git a/test/fixtures/domains.yml b/test/fixtures/domains.yml index 4d6468c92..5c4744e49 100644 --- a/test/fixtures/domains.yml +++ b/test/fixtures/domains.yml @@ -4,7 +4,11 @@ shop: registrar: bestnames registrant: john transfer_code: 65078d5 - valid_to: 2010-07-05 + registered_at: <%= Time.zone.parse('2010-07-04').to_s(:db) %> + valid_to: <%= Time.zone.parse('2010-07-05').to_s(:db) %> + outzone_at: <%= Time.zone.parse('2010-07-06').to_s(:db) %> + delete_at: <%= Time.zone.parse('2010-07-07').to_s(:db) %> + force_delete_at: <%= Time.zone.parse('2010-07-08').to_s(:db) %> period: 1 period_unit: m uuid: 1b3ee442-e8fe-4922-9492-8fcb9dccc69c diff --git a/test/system/registrant_area/contacts/details_test.rb b/test/system/registrant_area/contacts/details_test.rb new file mode 100644 index 000000000..c63a7d58e --- /dev/null +++ b/test/system/registrant_area/contacts/details_test.rb @@ -0,0 +1,35 @@ +require 'test_helper' + +class RegistrantAreaContactDetailsTest < ApplicationSystemTestCase + setup do + sign_in users(:registrant) + @contact = contacts(:john) + + Setting.days_to_keep_business_registry_cache = 1 + travel_to Time.zone.parse('2010-07-05') + end + + def test_general_data + visit registrant_domain_contact_url(domains(:shop), @contact) + assert_text 'Code john-001' + assert_text 'Name John' + + assert_text 'Auth info' + assert_css('[value="cacb5b"]') + + assert_text 'Ident 1234' + assert_text 'Email john@inbox.test' + assert_text 'Phone +555.555' + + assert_text "Created at #{l Time.zone.parse('2010-07-05')}" + assert_text "Updated at #{l Time.zone.parse('2010-07-06')}" + end + + def test_registrant_user_cannot_access_contact_when_given_domain_belongs_to_another_user + suppress(ActionView::Template::Error) do + visit registrant_domain_contact_url(domains(:metro), @contact) + assert_response :not_found + assert_no_text 'Name John' + end + end +end \ No newline at end of file diff --git a/test/system/registrant_area/domains/details_test.rb b/test/system/registrant_area/domains/details_test.rb new file mode 100644 index 000000000..de3db7e7d --- /dev/null +++ b/test/system/registrant_area/domains/details_test.rb @@ -0,0 +1,65 @@ +require 'test_helper' + +class RegistrantAreaDomainDetailsTest < ApplicationSystemTestCase + setup do + sign_in users(:registrant) + @domain = domains(:shop) + + Setting.days_to_keep_business_registry_cache = 1 + travel_to Time.zone.parse('2010-07-05') + end + + def test_general_data + visit registrant_domain_url(@domain) + assert_text 'Name shop.test' + assert_text "Registered at #{l Time.zone.parse('2010-07-04')}" + assert_link 'Best Names', href: registrant_registrar_path(@domain.registrar) + + assert_text 'Transfer code' + assert_css('[value="65078d5"]') + + assert_text "Valid to #{l Time.zone.parse('2010-07-05')}" + assert_text "Outzone at #{l Time.zone.parse('2010-07-06')}" + assert_text "Delete at #{l Time.zone.parse('2010-07-07')}" + assert_text "Force delete at #{l Time.zone.parse('2010-07-08')}" + end + + def test_registrant + visit registrant_domain_url(@domain) + assert_link 'John', href: registrant_domain_contact_path(@domain, @domain.registrant) + assert_text 'Code john-001' + assert_text 'Ident 1234' + assert_text 'Email john@inbox.test' + assert_text 'Phone +555.555' + end + + def test_admin_contacts + visit registrant_domain_url(@domain) + + within('.admin-domain-contacts') do + assert_link 'Jane', href: registrant_domain_contact_path(@domain, contacts(:jane)) + assert_text 'jane-001' + assert_text 'jane@mail.test' + assert_css '.admin-domain-contact', count: 1 + end + end + + def test_tech_contacts + visit registrant_domain_url(@domain) + + within('.tech-domain-contacts') do + assert_link 'William', href: registrant_domain_contact_path(@domain, contacts(:william)) + assert_text 'william-001' + assert_text 'william@inbox.test' + assert_css '.tech-domain-contact', count: 2 + end + end + + def test_registrant_user_cannot_access_domains_of_other_users + suppress(ActiveRecord::RecordNotFound) do + visit registrant_domain_url(domains(:metro)) + assert_response :not_found + assert_no_text 'metro.test' + end + end +end \ No newline at end of file diff --git a/test/system/registrant_area/domains/list_test.rb b/test/system/registrant_area/domains/list_test.rb new file mode 100644 index 000000000..592cb7021 --- /dev/null +++ b/test/system/registrant_area/domains/list_test.rb @@ -0,0 +1,25 @@ +require 'test_helper' + +class RegistrantAreaDomainListTest < ApplicationSystemTestCase + setup do + sign_in users(:registrant) + @domain = domains(:shop) + + Setting.days_to_keep_business_registry_cache = 1 + travel_to Time.zone.parse('2010-07-05') + end + + def test_show_domain_list + visit registrant_domains_url + assert_link 'shop.test', href: registrant_domain_path(@domain) + assert_link 'John', href: registrant_domain_contact_path(@domain, @domain.registrant) + assert_link 'Best Names', href: registrant_registrar_path(@domain.registrar) + assert_text l(Time.zone.parse('2010-07-05')) + assert_css '.domains .domain', count: 4 + end + + def test_do_not_show_domains_of_other_registrant_users + visit registrant_domains_url + assert_no_text 'metro.test' + end +end \ No newline at end of file