Improve ContactMailer

- Add detailed registrar info
- Refactor contact domain list
- Fix english translation

#480
This commit is contained in:
Artur Beljajev 2017-06-08 02:06:00 +03:00
parent 37004c24ba
commit 49552fc67e
11 changed files with 220 additions and 37 deletions

View file

@ -8,6 +8,7 @@ class RegistrantPresenter
:reg_no,
:street, :city, :state, :zip, :country,
:ident_country,
:used?,
to: :registrant
def initialize(registrant:, view:)
@ -23,6 +24,17 @@ class RegistrantPresenter
registrant.ident_country.translation(locale)
end
def domain_names_with_roles(locale: I18n.locale, line_break: "\n")
lines = []
registrant.domain_names_with_roles.each do |domain_name, roles|
lines << "#{domain_name} (#{roles.map { |role| role.to_s.classify.constantize.model_name.human(locale: locale) }
.join(', ')})"
end
lines.join(line_break)
end
private
attr_reader :registrant