Skip to content

Commit

Permalink
Merge pull request #828 from alphagov/fix-sidebar-taxon-showing
Browse files Browse the repository at this point in the history
Fix sidebar taxon showing
  • Loading branch information
tijmenb authored Mar 14, 2018
2 parents 48372b1 + 486795c commit 26ac019
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/navigation_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ def initialize(content_item)

def should_present_taxonomy_navigation?
!content_is_tagged_to_browse_pages? &&
content_is_tagged_to_a_taxon? &&
content_is_tagged_to_a_live_taxon? &&
content_schema_is_guidance?
end

private

def content_is_tagged_to_a_taxon?
@content_item.dig("links", "taxons").present?
def content_is_tagged_to_a_live_taxon?
@content_item.dig("links", "taxons").to_a.any? { |taxon| taxon["phase"] == "live" }
end

def content_is_tagged_to_browse_pages?
Expand Down
3 changes: 3 additions & 0 deletions app/views/shared/_sidebar_navigation.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<% if step_nav_helper.show_related_links? %>
<!-- Rendering the step by step -->
<%= render 'shared/sidebar_step_nav', no_margin: true %>
<% else %>
<div class="column-third">
<% if @navigation.should_present_taxonomy_navigation? %>
<!-- Rendering the taxonomy based sidebar -->
<%= render partial: 'govuk_component/taxonomy_sidebar', locals: @content_item.taxonomy_sidebar %>
<% else %>
<!-- Rendering the related navigation -->
<%= render 'govuk_publishing_components/components/related_navigation', @content_item.content_item.parsed_content %>
<% end %>
</div>
Expand Down

0 comments on commit 26ac019

Please sign in to comment.