mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Fix i18n
This commit is contained in:
parent
3979fc5f8f
commit
489cd2f7e5
4 changed files with 23 additions and 11 deletions
|
@ -26,19 +26,11 @@ class Registrar
|
|||
|
||||
private
|
||||
|
||||
def process_response(response:, start_notice: "", active_tab:)
|
||||
def process_response(response:, start_notice: '', active_tab:)
|
||||
parsed_response = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
if response.code == '200'
|
||||
notices = [start_notice]
|
||||
|
||||
notices << "#{t('registrar.tech_contacts.process_request.affected_domains')}: " \
|
||||
"#{parsed_response[:data][:affected_domains].join(', ')}"
|
||||
|
||||
if parsed_response[:data][:skipped_domains]
|
||||
notices << "#{t('registrar.tech_contacts.process_request.skipped_domains')}: " \
|
||||
"#{parsed_response[:data][:skipped_domains].join(', ')}"
|
||||
end
|
||||
notices = success_notices(parsed_response, start_notice)
|
||||
|
||||
flash[:notice] = notices.join(', ')
|
||||
redirect_to registrar_domains_url
|
||||
|
@ -48,6 +40,19 @@ class Registrar
|
|||
end
|
||||
end
|
||||
|
||||
def success_notices(parsed_response, start_notice)
|
||||
notices = [start_notice]
|
||||
|
||||
notices << "#{t('.affected_domains')}: " \
|
||||
"#{parsed_response[:data][:affected_domains].join(', ')}"
|
||||
|
||||
if parsed_response[:data][:skipped_domains]
|
||||
notices << "#{t('.skipped_domains')}: " \
|
||||
"#{parsed_response[:data][:skipped_domains].join(', ')}"
|
||||
end
|
||||
notices
|
||||
end
|
||||
|
||||
def do_request(request, uri)
|
||||
response = if Rails.env.test?
|
||||
do_test_request(request, uri)
|
||||
|
|
|
@ -15,7 +15,7 @@ class Registrar
|
|||
|
||||
response = do_request(request, uri)
|
||||
|
||||
start_notice = t('registrar.tech_contacts.process_request.replaced')
|
||||
start_notice = t('.replaced')
|
||||
|
||||
process_response(response: response,
|
||||
start_notice: start_notice,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue