Browse Source

Merge branch 'feature/breadcrumb-dyn' into develop

* feature/breadcrumb-dyn:
  Make breadcrumb render only the chunks that are actually set
tags/0.3.6^2
Bèr Kessels 1 month ago
parent
commit
82e5cb3fbf
3 changed files with 22 additions and 11 deletions
  1. 17
    0
      app/views/breadcrumb_partial.erb
  2. 1
    11
      app/views/layout.erb
  3. 4
    0
      lib/capture_helpers.rb

+ 17
- 0
app/views/breadcrumb_partial.erb View File

@@ -0,0 +1,17 @@
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Openingstijden</a></li>
<%- if content_for?(:region_slug) && content_for?(:region_name) %>
<li class="breadcrumb-item">
<a href="/in/<%= content_for(:region_slug) %>">
in <%= content_for(:region_name) %>
</a>
</li>
<%- end %>
<%- if content_for?(:place_name) %>
<li class="breadcrumb-item active" aria-current="page">
<%= content_for(:place_name) %>
</li>
<%- end %>
</ol>
</nav>

+ 1
- 11
app/views/layout.erb View File

@@ -13,17 +13,7 @@
<body>
<div class="container-fluid">
<h1 class="title">Openingstijden</h1>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Openingstijden</a></li>
<li class="breadcrumb-item"><a href="/in/<%= content_for(:region_slug) %>">
in <%= content_for(:region_name) %>
</a></li>
<li class="breadcrumb-item active" aria-current="page">
<%= content_for(:place_name) %>
</li>
</ol>
</nav>
<%== erb :breadcrumb_partial %>
<%== yield %>
</div>
<script>

+ 4
- 0
lib/capture_helpers.rb View File

@@ -13,4 +13,8 @@ module CaptureHelpers

@content_map[id]
end

def content_for?(id)
@content_map&.key?(id)
end
end

Loading…
Cancel
Save