1
0
Fork 0

Create partial "people/_common_descr_list_items"

This commit is contained in:
Alex Kotov 2020-04-10 16:25:27 +05:00
parent 5a3f8d2a6e
commit e3f410c223
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 46 additions and 63 deletions

View File

@ -0,0 +1,41 @@
<dt><%= Person.human_attribute_name :last_name %></dt>
<dd>
<%= maybe_or_none person.last_name.present? do %>
<%= truncate person.last_name %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :first_name %></dt>
<dd>
<%= maybe_or_none person.first_name.present? do %>
<%= truncate person.first_name %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :middle_name %></dt>
<dd>
<%= maybe_or_none person.middle_name.present? do %>
<%= truncate person.middle_name %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :sex %></dt>
<dd>
<%= maybe_or_none person.sex.present? do %>
<%= translate_enum :sex, person.sex %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :date_of_birth %></dt>
<dd>
<%= maybe_or_none person.date_of_birth.present? do %>
<%= localize person.date_of_birth %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :place_of_birth %></dt>
<dd>
<%= maybe_or_none person.place_of_birth.present? do %>
<%= truncate person.place_of_birth %>
<% end %>
</dd>

View File

@ -11,47 +11,8 @@
</p>
<% else %>
<dl>
<dt><%= Person.human_attribute_name :last_name %></dt>
<dd>
<%= maybe_or_none @account.person.last_name.present? do %>
<%= truncate @account.person.last_name %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :first_name %></dt>
<dd>
<%= maybe_or_none @account.person.first_name.present? do %>
<%= truncate @account.person.first_name %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :middle_name %></dt>
<dd>
<%= maybe_or_none @account.person.middle_name.present? do %>
<%= truncate @account.person.middle_name %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :sex %></dt>
<dd>
<%= maybe_or_none @account.person.sex.present? do %>
<%= translate_enum :sex, @account.person.sex %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :date_of_birth %></dt>
<dd>
<%= maybe_or_none @account.person.date_of_birth.present? do %>
<%= localize @account.person.date_of_birth %>
<% end %>
</dd>
<dt><%= Person.human_attribute_name :place_of_birth %></dt>
<dd>
<%= maybe_or_none @account.person.place_of_birth.present? do %>
<%= truncate @account.person.place_of_birth %>
<% end %>
</dd>
<%= render partial: 'people/common_descr_list_items',
locals: { person: @account.person } %>
</dl>
<% end %>
</div>

View File

@ -16,7 +16,7 @@
<% end %>
</div>
<div class="col-md-4">
<div class="col-md-8">
<dl>
<dt><%= Person.human_attribute_name :account %></dt>
<dd>
@ -36,27 +36,8 @@
<% end %>
</dd>
<dt><%= Person.human_attribute_name :last_name %></dt>
<dd><%= truncate @person.last_name %></dd>
<dt><%= Person.human_attribute_name :first_name %></dt>
<dd><%= truncate @person.first_name %></dd>
<dt><%= Person.human_attribute_name :middle_name %></dt>
<dd><%= truncate @person.middle_name %></dd>
</dl>
</div>
<div class="col-md-4">
<dl>
<dt><%= Person.human_attribute_name :sex %></dt>
<dd><%= translate_enum :sex, @person.sex if @person.sex %></dd>
<dt><%= Person.human_attribute_name :date_of_birth %></dt>
<dd><%= localize @person.date_of_birth if @person.date_of_birth %></dd>
<dt><%= Person.human_attribute_name :place_of_birth %></dt>
<dd><%= truncate @person.place_of_birth if @person.place_of_birth %></dd>
<%= render partial: 'people/common_descr_list_items',
locals: { person: @person } %>
</dl>
</div>
</div>