From ed2effdbad8ae37ee5a91fd14b097ab379022df6 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 15 Aug 2019 08:40:34 +0500 Subject: [PATCH] Display short position --- app/helpers/relationships_helper.rb | 8 ++++++++ app/views/staffs/people/relationships/index.html.erb | 2 +- config/locales/enums/en.yml | 7 +++++++ config/locales/enums/ru.yml | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/helpers/relationships_helper.rb b/app/helpers/relationships_helper.rb index 60cd642..3f641a7 100644 --- a/app/helpers/relationships_helper.rb +++ b/app/helpers/relationships_helper.rb @@ -20,4 +20,12 @@ module RelationshipsHelper translate_enum :relationship_position, relationship.position end end + + def relationship_short_position_or_none(relationship) + if relationship&.position.nil? + translate :none + else + translate_enum :relationship_short_position, relationship.position + end + end end diff --git a/app/views/staffs/people/relationships/index.html.erb b/app/views/staffs/people/relationships/index.html.erb index 1bd4114..3e2451d 100644 --- a/app/views/staffs/people/relationships/index.html.erb +++ b/app/views/staffs/people/relationships/index.html.erb @@ -48,7 +48,7 @@ <%= relationship.id %> <%= relationship_status_or_none relationship %> - <%= relationship_position_or_none relationship %> + <%= relationship_short_position_or_none relationship %> <%= relationship_from_date_or_none relationship %> <%= staff_regional_office_link_or_none \ diff --git a/config/locales/enums/en.yml b/config/locales/enums/en.yml index 143f028..046f810 100644 --- a/config/locales/enums/en.yml +++ b/config/locales/enums/en.yml @@ -15,3 +15,10 @@ en: regional_manager: Regional manager regional_supervisor: Regional supervisor regional_secretary: Regional secretary + relationship_short_position: + federal_manager: Federal manager + federal_supervisor: Federal supervisor + federal_secretary: Federal secretary + regional_manager: Regional manager + regional_supervisor: Regional supervisor + regional_secretary: Regional secretary diff --git a/config/locales/enums/ru.yml b/config/locales/enums/ru.yml index 8be2738..867f6e2 100644 --- a/config/locales/enums/ru.yml +++ b/config/locales/enums/ru.yml @@ -17,6 +17,13 @@ ru: Член контрольно-ревизионной комиссии регионального отделения regional_secretary: >- Секретарь руководящего комитета регионального отделения + relationship_short_position: + federal_manager: Член ФК + federal_supervisor: Член ЦКРК + federal_secretary: Секретарь ФК + regional_manager: Член РК РО + regional_supervisor: Член КРК РО + regional_secretary: Секретарь РК РО relationship_role: federal_manager: Член федерального комитета