Browse Source

Merge branch 'feature/no-breadcrumbs-home' into develop

* feature/no-breadcrumbs-home:
  Only render breadcrumb if we have a breadcrumb
tags/0.3.6^2
Bèr Kessels 1 month ago
parent
commit
57d4a02c9c
2 changed files with 23 additions and 15 deletions
  1. 17
    15
      app/views/breadcrumb_partial.erb
  2. 6
    0
      lib/capture_helpers.rb

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

@@ -1,17 +1,19 @@
<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>
<%- if render_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>
<%- end %>
</nav>

+ 6
- 0
lib/capture_helpers.rb View File

@@ -8,6 +8,12 @@ module CaptureHelpers
@content_map[id] = content
end

def render_breadcrumb?
# For now, just see if the first dynamic item in the bc is set
# This avoids rending "only the static Openingstijden" name.
content_for?(:region_slug) && content_for?(:region_name)
end

def content_for(id)
return '' unless @content_map&.key?(id)


Loading…
Cancel
Save