Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add banner to the taxonomy navigation #1041

Merged
merged 1 commit into from
Aug 14, 2018

Conversation

andrewgarner
Copy link
Contributor

@andrewgarner andrewgarner commented Aug 10, 2018

This adds a breadcrumb and a banner navigation element listing things a content item is part of.

If the content item is tagged to a single topic a full breadcrumb to it is shown. If it is tagged to multiple topics then a home breadcrumb is shown and the topics are listed in the banner.

Some examples:

One topic and step by step: /vehicle-insurance

screen shot 2018-08-10 at 16 39 27

Multiple topics and a step by step: /vehicle-registration/new-and-used-vehicles

screen shot 2018-08-10 at 16 38 09

One topic, no step by step: /pay-dartford-crossing-charge

screen shot 2018-08-10 at 16 40 03

https://trello.com/c/rznwkADc


Visual regression results:
https://government-frontend-pr-1041.surge.sh/gallery.html

Component guide for this PR:
https://government-frontend-pr-1041.herokuapp.com/component-guide

@benthorner benthorner temporarily deployed to government-frontend-pr-1041 August 10, 2018 15:41 Inactive
@andrewgarner andrewgarner requested a review from sihugh August 10, 2018 15:41
@benthorner benthorner temporarily deployed to government-frontend-pr-1041 August 10, 2018 15:52 Inactive
@andrewgarner andrewgarner force-pushed the taxonomy-navigation-top-banner-links branch from 54e2350 to 3d2d674 Compare August 10, 2018 16:13
@benthorner benthorner temporarily deployed to government-frontend-pr-1041 August 10, 2018 16:13 Inactive
.content_item
.dig('links', 'part_of_step_navs')
.yield_self { |part_of_step_navs| part_of_step_navs || [] }
.select { |step_by_step_nav| step_by_step_nav['document_type'] == 'step_by_step_nav' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part_of_step_navs should only contain step_by_step_nav documents so we can remove this line if we want.

@@ -97,6 +97,20 @@ def load_taxonomy_navigation
.yield_self { |document_collections| document_collections || [] }
.select { |document_collection| document_collection['document_type'] == 'document_collection' }
.map { |document_collection| document_collection.values_at('base_path', 'title') }

@banner_items = @content_item
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we extract this to give it some context? It's a bit hard to mentally parse something this long, so might benefit from pulled out and given a name?

<% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(@content_item.content_item.parsed_content, request.path) %>

<% if @tagged_taxons.present? || navigation.breadcrumbs.present? %>
<div class='gem-c-contextual-breadcrumbs'>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll need to remember to communicate that we're doing this 📣

@andrewgarner andrewgarner force-pushed the taxonomy-navigation-top-banner-links branch from 3d2d674 to 4546de0 Compare August 14, 2018 10:24
@benthorner benthorner temporarily deployed to government-frontend-pr-1041 August 14, 2018 10:24 Inactive
@andrewgarner andrewgarner force-pushed the taxonomy-navigation-top-banner-links branch from 4546de0 to 3156396 Compare August 14, 2018 13:45
@benthorner benthorner temporarily deployed to government-frontend-pr-1041 August 14, 2018 13:45 Inactive
This adds a breadcrumb and a banner navigation element listing things a
content item is part of.

If the content item is tagged to a single topic a full breadcrumb to it
is shown. If it is tagged to multiple topics then a home breadcrumb is
shown and the topics are listed in the banner.

Some examples:

- One topic and step by step: /vehicle-insurance
- Multiple topics and a step by step: /vehicle-registration/new-and-used-vehicles
- One topic, no step by step: /pay-dartford-crossing-charge

https://trello.com/c/rznwkADc
@sihugh sihugh merged commit a936ce3 into master Aug 14, 2018
@sihugh sihugh deleted the taxonomy-navigation-top-banner-links branch August 14, 2018 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants