1
0
Fork 0

Add breadcrumbs

This commit is contained in:
Alex Kotov 2019-07-26 09:46:01 +05:00
parent 6551ab2a07
commit b9b86caf4c
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
9 changed files with 121 additions and 0 deletions

View file

@ -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

View file

@ -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>

View file

@ -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">

View file

@ -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>

View file

@ -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>

View file

@ -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 } %>

View file

@ -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 } %>

View file

@ -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>

View file

@ -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