Add helper method RegionalOfficesHelper#regional_office_link_or_none
This commit is contained in:
parent
a8e4d46a2e
commit
3db59dee2f
2 changed files with 15 additions and 10 deletions
14
app/helpers/regional_offices_helper.rb
Normal file
14
app/helpers/regional_offices_helper.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RegionalOfficesHelper
|
||||||
|
def regional_office_link_or_none(regional_office)
|
||||||
|
if regional_office.nil?
|
||||||
|
translate :none
|
||||||
|
elsif policy(regional_office.federal_subject).show?
|
||||||
|
link_to regional_office.federal_subject.display_name,
|
||||||
|
regional_office.federal_subject
|
||||||
|
else
|
||||||
|
regional_office.federal_subject.display_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -22,16 +22,7 @@
|
||||||
<dd><%= staff_account_link_or_none @person.account %></dd>
|
<dd><%= staff_account_link_or_none @person.account %></dd>
|
||||||
|
|
||||||
<dt><%= Person.human_attribute_name :current_regional_office %></dt>
|
<dt><%= Person.human_attribute_name :current_regional_office %></dt>
|
||||||
<dd>
|
<dd><%= regional_office_link_or_none @person.current_regional_office %></dd>
|
||||||
<% if @person.current_regional_office %>
|
|
||||||
<%= link_to(
|
|
||||||
@person.current_regional_office.federal_subject.display_name,
|
|
||||||
@person.current_regional_office.federal_subject,
|
|
||||||
) %>
|
|
||||||
<% else %>
|
|
||||||
<%= translate :none %>
|
|
||||||
<% end %>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt><%= Person.human_attribute_name :last_name %></dt>
|
<dt><%= Person.human_attribute_name :last_name %></dt>
|
||||||
<dd><%= truncate @person.last_name %></dd>
|
<dd><%= truncate @person.last_name %></dd>
|
||||||
|
|
Reference in a new issue