1
0
Fork 0

Display Account#person

This commit is contained in:
Alex Kotov 2019-08-14 17:18:18 +05:00
parent 3db59dee2f
commit 6d1f967968
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 15 additions and 0 deletions

View file

@ -1,6 +1,16 @@
# frozen_string_literal: true # frozen_string_literal: true
module PeopleHelper 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) def person_status(person)
if person.nil? || person.current_relationship.nil? if person.nil? || person.current_relationship.nil?
return translate :not_in_party, scope: %i[helpers person_status] return translate :not_in_party, scope: %i[helpers person_status]

View file

@ -32,5 +32,8 @@
<dt><%= Account.human_attribute_name :public_name %></dt> <dt><%= Account.human_attribute_name :public_name %></dt>
<dd><%= @account.public_name %></dd> <dd><%= @account.public_name %></dd>
<dt><%= Account.human_attribute_name :person %></dt>
<dd><%= staff_person_link_or_none @account.person %></dd>
</dl> </dl>
</div> </div>

View file

@ -29,6 +29,7 @@ en:
public_name: Public name public_name: Public name
biography: Bio biography: Bio
avatar: Avatar avatar: Avatar
person: Person
federal_subject: federal_subject:
id: ID id: ID
regional_office: Regional department regional_office: Regional department

View file

@ -29,6 +29,7 @@ ru:
public_name: Публичное имя public_name: Публичное имя
biography: Биография biography: Биография
avatar: Аватар avatar: Аватар
person: Человек
federal_subject: federal_subject:
id: ID id: ID
regional_office: Региональное отделение regional_office: Региональное отделение