Add breadcrumbs
This commit is contained in:
parent
6551ab2a07
commit
b9b86caf4c
9 changed files with 121 additions and 0 deletions
|
@ -35,4 +35,16 @@ class Person < ApplicationRecord
|
|||
###############
|
||||
|
||||
validates :contacts_list, uniqueness: true
|
||||
|
||||
###########
|
||||
# Methods #
|
||||
###########
|
||||
|
||||
def full_name
|
||||
[
|
||||
last_name,
|
||||
first_name,
|
||||
middle_name,
|
||||
].map(&:presence).compact.join(' ').freeze
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
<%= FederalSubject.model_name.human count: 0 %>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<%= link_to FederalSubject.model_name.human(count: 0),
|
||||
federal_subjects_path %>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
<%= @federal_subject.display_name %>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<h1><%= @federal_subject.native_name %></h1>
|
||||
|
||||
<p class="h1">
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
<%= translate :staff_services %>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<ul>
|
||||
<% if policy(%i[staff person]).index? %>
|
||||
<li>
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<%= link_to translate(:staff_services), staff_root_path %>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
<%= Person.model_name.human count: 0 %>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<%= link_to translate(:staff_services), staff_root_path %>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item">
|
||||
<%= link_to Person.model_name.human(count: 0), staff_people_path %>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
<%= @person.full_name %>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<%= render partial: 'staffs/people/nav_tabs', locals: { person: @person,
|
||||
tab: :passports } %>
|
||||
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<%= link_to translate(:staff_services), staff_root_path %>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item">
|
||||
<%= link_to Person.model_name.human(count: 0), staff_people_path %>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
<%= @person.full_name %>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<%= render partial: 'staffs/people/nav_tabs',
|
||||
locals: { person: @person, tab: :person_comments } %>
|
||||
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<%= link_to translate(:staff_services), staff_root_path %>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item">
|
||||
<%= link_to Person.model_name.human(count: 0), staff_people_path %>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
<%= @person.full_name %>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<%= render partial: 'nav_tabs', locals: { person: @person, tab: :overview } %>
|
||||
|
||||
<dl>
|
||||
|
|
|
@ -113,4 +113,24 @@ RSpec.describe Person do
|
|||
.dependent(:restrict_with_exception)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#full_name' do
|
||||
specify do
|
||||
expect(subject.full_name).to be_instance_of String
|
||||
end
|
||||
|
||||
specify do
|
||||
expect(subject.full_name).to be_frozen
|
||||
end
|
||||
|
||||
specify do
|
||||
expect(subject.full_name).to eq(
|
||||
[
|
||||
subject.last_name,
|
||||
subject.first_name,
|
||||
subject.middle_name,
|
||||
].compact.join(' '),
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Reference in a new issue