Improve breadcrumbs
This commit is contained in:
parent
9cf986ad4c
commit
69a2a922f7
11 changed files with 62 additions and 123 deletions
|
@ -6,6 +6,29 @@ module NavsHelper
|
||||||
pills: 'nav nav-pills d-flex d-sm-none flex-column',
|
pills: 'nav nav-pills d-flex d-sm-none flex-column',
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
def nav_breadcrumb(*args, active_text)
|
||||||
|
tag.nav 'aria-label': 'breadcrumb' do
|
||||||
|
tag.ol class: 'breadcrumb' do
|
||||||
|
args.each do |(text, url)|
|
||||||
|
concat nav_breadcrumb_item text, url
|
||||||
|
end
|
||||||
|
concat nav_breadcrumb_item active_text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def nav_breadcrumb_item(text, url = nil)
|
||||||
|
if url
|
||||||
|
tag.li class: 'breadcrumb-item' do
|
||||||
|
link_to text, url
|
||||||
|
end
|
||||||
|
else
|
||||||
|
tag.li class: 'breadcrumb-item active', 'aria-current': 'page' do
|
||||||
|
text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def nav_tabs(scope_name, active_tab_name, options)
|
def nav_tabs(scope_name, active_tab_name, options)
|
||||||
capture do
|
capture do
|
||||||
concat nav_tabs_list scope_name, active_tab_name, :tabs, options
|
concat nav_tabs_list scope_name, active_tab_name, :tabs, options
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb FederalSubject.model_name.human count: 0 %>
|
||||||
<ol class="breadcrumb">
|
|
||||||
<li class="breadcrumb-item active" aria-current="page">
|
|
||||||
<%= FederalSubject.model_name.human count: 0 %>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb(
|
||||||
<ol class="breadcrumb">
|
[FederalSubject.model_name.human(count: 0), federal_subjects_path],
|
||||||
<li class="breadcrumb-item">
|
@federal_subject.display_name,
|
||||||
<%= 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>
|
<h1><%= @federal_subject.native_name %></h1>
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb(
|
||||||
<ol class="breadcrumb">
|
[translate(:staff_services), staff_root_path],
|
||||||
<li class="breadcrumb-item">
|
Account.model_name.human(count: 0),
|
||||||
<%= link_to translate(:staff_services), staff_root_path %>
|
) %>
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="breadcrumb-item active" aria-current="page">
|
|
||||||
<%= Account.model_name.human count: 0 %>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -1,19 +1,9 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb(
|
||||||
<ol class="breadcrumb">
|
[translate(:staff_services), staff_root_path],
|
||||||
<li class="breadcrumb-item">
|
[Account.model_name.human(count: 0), staff_accounts_path],
|
||||||
<%= link_to translate(:staff_services), staff_root_path %>
|
@account.nickname,
|
||||||
</li>
|
) %>
|
||||||
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<%= link_to Account.model_name.human(count: 0), staff_accounts_path %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="breadcrumb-item active" aria-current="page">
|
|
||||||
<%= @account.nickname %>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<% if @account.superuser? %>
|
<% if @account.superuser? %>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb translate :staff_services %>
|
||||||
<ol class="breadcrumb">
|
|
||||||
<li class="breadcrumb-item active" aria-current="page">
|
|
||||||
<%= translate :staff_services %>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% if policy(%i[staff account]).index? %>
|
<% if policy(%i[staff account]).index? %>
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb(
|
||||||
<ol class="breadcrumb">
|
[translate(:staff_services), staff_root_path],
|
||||||
<li class="breadcrumb-item">
|
Person.model_name.human(count: 0),
|
||||||
<%= 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">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -1,19 +1,9 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb(
|
||||||
<ol class="breadcrumb">
|
[translate(:staff_services), staff_root_path],
|
||||||
<li class="breadcrumb-item">
|
[Person.model_name.human(count: 0), staff_people_path],
|
||||||
<%= link_to translate(:staff_services), staff_root_path %>
|
@person.full_name,
|
||||||
</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,
|
<%= render partial: 'staffs/people/nav_tabs', locals: { person: @person,
|
||||||
tab: :passports } %>
|
tab: :passports } %>
|
||||||
|
|
|
@ -1,19 +1,9 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb(
|
||||||
<ol class="breadcrumb">
|
[translate(:staff_services), staff_root_path],
|
||||||
<li class="breadcrumb-item">
|
[Person.model_name.human(count: 0), staff_people_path],
|
||||||
<%= link_to translate(:staff_services), staff_root_path %>
|
@person.full_name,
|
||||||
</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',
|
<%= render partial: 'staffs/people/nav_tabs',
|
||||||
locals: { person: @person, tab: :person_comments } %>
|
locals: { person: @person, tab: :person_comments } %>
|
||||||
|
|
|
@ -1,19 +1,9 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb(
|
||||||
<ol class="breadcrumb">
|
[translate(:staff_services), staff_root_path],
|
||||||
<li class="breadcrumb-item">
|
[Person.model_name.human(count: 0), staff_people_path],
|
||||||
<%= link_to translate(:staff_services), staff_root_path %>
|
@person.full_name,
|
||||||
</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',
|
<%= render partial: 'staffs/people/nav_tabs',
|
||||||
locals: { person: @person, tab: :relationships } %>
|
locals: { person: @person, tab: :relationships } %>
|
||||||
|
|
|
@ -1,19 +1,9 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav aria-label="breadcrumb">
|
<%= nav_breadcrumb(
|
||||||
<ol class="breadcrumb">
|
[translate(:staff_services), staff_root_path],
|
||||||
<li class="breadcrumb-item">
|
[Person.model_name.human(count: 0), staff_people_path],
|
||||||
<%= link_to translate(:staff_services), staff_root_path %>
|
@person.full_name,
|
||||||
</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 } %>
|
<%= render partial: 'nav_tabs', locals: { person: @person, tab: :overview } %>
|
||||||
|
|
||||||
|
|
Reference in a new issue