diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index df626ec..8df0b12 100644 --- a/app/helpers/people_helper.rb +++ b/app/helpers/people_helper.rb @@ -1,6 +1,16 @@ # frozen_string_literal: true module PeopleHelper + def staff_person_link_or_none(person) + if person.nil? + translate :none + elsif policy([:staff, person]).show? + link_to person.full_name, [:staff, person] + else + person.full_name + end + end + def person_status(person) if person.nil? || person.current_relationship.nil? return translate :not_in_party, scope: %i[helpers person_status] diff --git a/app/views/staffs/accounts/show.html.erb b/app/views/staffs/accounts/show.html.erb index eda4c49..0325f81 100644 --- a/app/views/staffs/accounts/show.html.erb +++ b/app/views/staffs/accounts/show.html.erb @@ -32,5 +32,8 @@
<%= Account.human_attribute_name :public_name %>
<%= @account.public_name %>
+ +
<%= Account.human_attribute_name :person %>
+
<%= staff_person_link_or_none @account.person %>
diff --git a/config/locales/activerecord/en.yml b/config/locales/activerecord/en.yml index aac4399..82e3770 100644 --- a/config/locales/activerecord/en.yml +++ b/config/locales/activerecord/en.yml @@ -29,6 +29,7 @@ en: public_name: Public name biography: Bio avatar: Avatar + person: Person federal_subject: id: ID regional_office: Regional department diff --git a/config/locales/activerecord/ru.yml b/config/locales/activerecord/ru.yml index 137fde3..2916fdc 100644 --- a/config/locales/activerecord/ru.yml +++ b/config/locales/activerecord/ru.yml @@ -29,6 +29,7 @@ ru: public_name: Публичное имя biography: Биография avatar: Аватар + person: Человек federal_subject: id: ID regional_office: Региональное отделение