From ca5edb16fa1699e579ada9c42a8f3a0a98f27858 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 15 Aug 2018 12:56:56 +0300 Subject: [PATCH] Refactor contact list --- app/views/registrant/domains/_domain.html.erb | 2 +- app/views/registrant/domains/index.html.erb | 2 +- .../domains/partials/_domain_contact.html.erb | 7 +++++++ ...tacts.html.erb => _domain_contacts.html.erb} | 17 ++++++----------- app/views/registrant/domains/show.html.erb | 10 ++++------ config/locales/registrant/domains.en.yml | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 app/views/registrant/domains/partials/_domain_contact.html.erb rename app/views/registrant/domains/partials/{_contacts.html.erb => _domain_contacts.html.erb} (69%) diff --git a/app/views/registrant/domains/_domain.html.erb b/app/views/registrant/domains/_domain.html.erb index 7228c9399..8cc8a490b 100644 --- a/app/views/registrant/domains/_domain.html.erb +++ b/app/views/registrant/domains/_domain.html.erb @@ -1,4 +1,4 @@ - + <%= link_to domain, registrant_domain_path(domain) %> <%= link_to domain.registrant.name, 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/_contacts.html.erb b/app/views/registrant/domains/partials/_domain_contacts.html.erb similarity index 69% rename from app/views/registrant/domains/partials/_contacts.html.erb rename to app/views/registrant/domains/partials/_domain_contacts.html.erb index c66d364c3..9b41288b7 100644 --- a/app/views/registrant/domains/partials/_contacts.html.erb +++ b/app/views/registrant/domains/partials/_domain_contacts.html.erb @@ -1,11 +1,12 @@ <% panel_class = errors ? 'panel-danger' : 'panel-default' %>
- <%= header %> + <%= t ".header_#{domain_contacts.model_name.plural.underscore}" %>
-
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 %>
+
@@ -15,15 +16,9 @@ - <% contacts.each do |contact| %> - - - - - - <% end %> + <%= render partial: 'registrant/domains/partials/domain_contact', + collection: domain_contacts, + locals: { domain: domain } %> <% if errors %> diff --git a/app/views/registrant/domains/show.html.erb b/app/views/registrant/domains/show.html.erb index fdbbc76cb..88d238c7d 100644 --- a/app/views/registrant/domains/show.html.erb +++ b/app/views/registrant/domains/show.html.erb @@ -19,20 +19,18 @@
- <%= render 'registrant/domains/partials/contacts', - header: t('.tech_contacts'), + <%= render 'registrant/domains/partials/domain_contacts', domain: @domain, - contacts: @domain.tech_contacts, + domain_contacts: @domain.tech_domain_contacts, errors: @domain.errors.messages[:tech_contacts] %>
- <%= render 'registrant/domains/partials/contacts', - header: t('.admin_contacts'), + <%= render 'registrant/domains/partials/domain_contacts', domain: @domain, - contacts: @domain.admin_contacts, + domain_contacts: @domain.admin_domain_contacts, errors: @domain.errors.messages[:admin_contacts] %>
diff --git a/config/locales/registrant/domains.en.yml b/config/locales/registrant/domains.en.yml index ebb3d2aec..8df58239f 100644 --- a/config/locales/registrant/domains.en.yml +++ b/config/locales/registrant/domains.en.yml @@ -9,11 +9,11 @@ en: download_list: registrant: Registrant - show: - admin_contacts: Administrative contacts - tech_contacts: Technical contacts - partials: registrant: header: Registrant view_details_btn: View details + + domain_contacts: + header_admin_domain_contacts: Administrative contacts + header_tech_domain_contacts: Technical contacts
<%= Contact.human_attribute_name :name %>
- <%= link_to contact, registrant_domain_contact_path(domain, contact) %> - <%= contact.code %><%= contact.email %>