From ac78717d6b5ed06369173f7a713cce1795db7f9b Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 4 Sep 2019 23:14:17 +0500 Subject: [PATCH] Display Contact#send_security_notifications --- app/helpers/application_helper.rb | 12 ++++++++++++ app/views/settings/contacts/_table.html.erb | 4 ++++ config/locales/activerecord/en.yml | 1 + config/locales/activerecord/ru.yml | 1 + 4 files changed, 18 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 00b9ef31..62522f6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -46,6 +46,18 @@ module ApplicationHelper end end + def bool_badge(value) + if value + tag.span class: 'badge badge-pill badge-success' do + translate :yes + end + else + tag.span class: 'badge badge-pill badge-secondary' do + translate :no + end + end + end + def translate_enum(type, value) translate value, scope: [:enums, type] end diff --git a/app/views/settings/contacts/_table.html.erb b/app/views/settings/contacts/_table.html.erb index 59d6254..b732fb5 100644 --- a/app/views/settings/contacts/_table.html.erb +++ b/app/views/settings/contacts/_table.html.erb @@ -7,6 +7,9 @@ <%= Contact.human_attribute_name :value %> + + <%= Contact.human_attribute_name :send_security_notifications %> + @@ -16,6 +19,7 @@ <%= contact.contact_network.name %> <%= truncate contact.value %> + <%= bool_badge contact.send_security_notifications %> <% if policy([:settings, contact]).destroy? %> <%= link_to( diff --git a/config/locales/activerecord/en.yml b/config/locales/activerecord/en.yml index 30b4ff9..f4381a3 100644 --- a/config/locales/activerecord/en.yml +++ b/config/locales/activerecord/en.yml @@ -49,6 +49,7 @@ en: id: ID contact_network: Contact network value: Value + send_security_notifications: Security notifications contact_network: id: ID codename: Codename diff --git a/config/locales/activerecord/ru.yml b/config/locales/activerecord/ru.yml index 1dac4ad..e2d0189 100644 --- a/config/locales/activerecord/ru.yml +++ b/config/locales/activerecord/ru.yml @@ -49,6 +49,7 @@ ru: id: ID contact_network: Сеть контактов value: Значение + send_security_notifications: Уведомления безопасности contact_network: id: ID codename: Кодовое имя