govuk_publishing_components 9.28.0 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +1 -15
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +81 -0
- data/lib/govuk_publishing_components/presenters/content_item.rb +0 -4
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +0 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eedc7db41f2d178ff05e1905a8eb380dd37140a8a0ed8c8e35adce4843820dcd
|
4
|
+
data.tar.gz: 02b05d72c20971d88bff48a36c42a910e8bf9882c4e9a88d827a9d4a5b399ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61fd9a082433a65c367b1e9f56b50d417bfcf1b1479e0830c2be22d7b63af18e91b923058be1d057e104a5bd7587b1e4d59a5887325f116712fa714729431341
|
7
|
+
data.tar.gz: 97c87c351d487aec51b61d9a9e2f6a696d21c6bf219ef94340be088d6f5e368b1692bcab27ecf6e204208d108188c3c7c46fd74549a13c679ee3012375c79e3b
|
@@ -1,5 +1,5 @@
|
|
1
1
|
name: Related Navigation
|
2
|
-
description: Component showing related content, including topics, guidance
|
2
|
+
description: Component showing related content, including topics, guidance and collections
|
3
3
|
accessibility_criteria: |
|
4
4
|
- Should have a role of 'navigation' on any navigation elements inside the component
|
5
5
|
- Should be marked up as navigation and not as tangential content
|
@@ -41,16 +41,6 @@ examples:
|
|
41
41
|
- title: The future of jobs and skills
|
42
42
|
base_path: /government/collections/the-future-of-jobs-and-skills
|
43
43
|
document_type: document_collection
|
44
|
-
with_policies:
|
45
|
-
data:
|
46
|
-
links:
|
47
|
-
related_policies:
|
48
|
-
- title: Further education and training
|
49
|
-
base_path: /government/policies/further-education-and-training
|
50
|
-
document_type: policy
|
51
|
-
- title: Primary school education
|
52
|
-
base_path: /government/policies/primary-school-education
|
53
|
-
document_type: policy
|
54
44
|
with_topical_events:
|
55
45
|
data:
|
56
46
|
links:
|
@@ -151,10 +141,6 @@ examples:
|
|
151
141
|
- title: The future of jobs and skills
|
152
142
|
base_path: /government/collections/the-future-of-jobs-and-skills
|
153
143
|
document_type: document_collection
|
154
|
-
related_policies:
|
155
|
-
- title: Further education and training
|
156
|
-
base_path: /government/policies/further-education-and-training
|
157
|
-
document_type: policy
|
158
144
|
world_locations:
|
159
145
|
- title: South Sudan
|
160
146
|
base_path: /world/south-sudan/news
|
@@ -403,6 +403,87 @@ examples:
|
|
403
403
|
]
|
404
404
|
}
|
405
405
|
]
|
406
|
+
tracking_the_user_journey_through_the_query_string:
|
407
|
+
description: |
|
408
|
+
When the step by step pattern was first introduced, one of the problems we noticed was that if a content page is in more than one step by step journey, it wasn't practical to expand all of the step by steps, as the sidebar became very long.
|
409
|
+
|
410
|
+
We solved this problem in a few ways:
|
411
|
+
|
412
|
+
1. Only show a list of titles for the step by steps that the content page is part of.
|
413
|
+
2. Only display this list if the content item is part of fewer than 5 step by step journeys
|
414
|
+
3. Allow content designers to optionally hide a step by step journey on content pages.
|
415
|
+
|
416
|
+
The consequence of this is that if users land on any of these pages, they lose sight of the journey they are on, and which step of the journey they have reached (the black dot).
|
417
|
+
|
418
|
+
The solution is to track the step by step journey the user is on.
|
419
|
+
|
420
|
+
This has been achieved by adding a query string to all of the internal links in the step by step that contains the content_id of the step by step.
|
421
|
+
|
422
|
+
For example, if the step by step contains a link to [/check-uk-visa](/check-uk-visa), the component will renders the link as [/check-uk-visa?step-by-step-nav=d8f3c2e0-d544-4664-9616-ab71323e4d18](/check-uk-visa?step-by-step-nav=d8f3c2e0-d544-4664-9616-ab71323e4d18)
|
423
|
+
|
424
|
+
As long as the user follows the links in the step by step (and not the inline links in the content), the component will know which step by step journey the user is on.
|
425
|
+
|
426
|
+
If the content item is part of multiple step by steps, the component fetches the content_id of the `active` step by step from the query string and expands that one. The other step by steps that the content item is part of are displayed as a list of titles under an "Also part of" heading.
|
427
|
+
|
428
|
+
Additionally, if content designers have chosen to "hide" a step by step on a content page, but we can see that the user is following a step by step journey (the content_id of the step by step is in the querystring), the step by step will still be displayed and expanded in the sidebar, and the other step by steps that the content item is part of, but content designers have chosen to hide will also be displayed as a list of titles under an "Also part of heading".
|
429
|
+
|
430
|
+
In both cases, we never show more than 5 step by steps in the list.
|
431
|
+
|
432
|
+
If the user lands on the content page "cold", i.e. from Google, and not from the step by step sidebar (or overview page), the original rules for the displaying the step by step sidebar will apply.
|
433
|
+
|
434
|
+
The rules are as follows:
|
435
|
+
|
436
|
+
1. Content item is part of one step by step
|
437
|
+
|
438
|
+
Expand the step by step in the sidebar
|
439
|
+
|
440
|
+
2. Content item is part of multiple step by steps
|
441
|
+
|
442
|
+
Show a list of step by steps under the "Part of" heading
|
443
|
+
|
444
|
+
3. Step by step is marked as "hidden" for the content page
|
445
|
+
|
446
|
+
Do not display the step by step
|
447
|
+
|
448
|
+
Changes to the rules when the user is on a step by step journey (the query string is in the url):
|
449
|
+
|
450
|
+
1. Content item is part of one step by step
|
451
|
+
|
452
|
+
No change, expand the step by step in the sidebar
|
453
|
+
|
454
|
+
2. Content item is part of multiple step by steps
|
455
|
+
|
456
|
+
Expand the step by step in the querystring
|
457
|
+
|
458
|
+
Show a list of the other step by steps under an "Also part of" heading, if the content item is part of less than 5 step by step journeys
|
459
|
+
|
460
|
+
3. Step by step is marked as "hidden" for the content page
|
461
|
+
|
462
|
+
Expand the step by step in the querystring
|
463
|
+
|
464
|
+
Show a list of the other step by steps (including other step by steps that have been marked as "hidden") under an "Also part of" heading, if the content item is part of less than 5 step by step journeys
|
465
|
+
data:
|
466
|
+
tracking_id: "this-is-the-content-id"
|
467
|
+
steps: [
|
468
|
+
{
|
469
|
+
title: "With query string",
|
470
|
+
contents: [
|
471
|
+
{
|
472
|
+
type: 'list',
|
473
|
+
contents: [
|
474
|
+
{
|
475
|
+
href: '/component-guide/step_by_step_navigation/with_links/preview?step-by-step-nav=this-is-the-content-id',
|
476
|
+
text: 'This is an internal link with a query string',
|
477
|
+
},
|
478
|
+
{
|
479
|
+
href: 'http://google.com',
|
480
|
+
text: 'This is an external link without a query string'
|
481
|
+
}
|
482
|
+
]
|
483
|
+
}
|
484
|
+
]
|
485
|
+
}
|
486
|
+
]
|
406
487
|
with_optional_steps:
|
407
488
|
description: |
|
408
489
|
Steps can be optional. This is controlled by two parameters, 'optional' and 'logic'.
|
@@ -90,10 +90,6 @@ module GovukPublishingComponents
|
|
90
90
|
filter_link_type(content_store_response.dig("links", "organisations").to_a, "organisation")
|
91
91
|
end
|
92
92
|
|
93
|
-
def related_policies
|
94
|
-
filter_link_type(content_store_response.dig("links", "related_policies").to_a, "policy")
|
95
|
-
end
|
96
|
-
|
97
93
|
def related_statistical_data_sets
|
98
94
|
filter_link_type(content_store_response.dig("links", "related_statistical_data_sets").to_a, "statistical_data_set")
|
99
95
|
end
|
@@ -8,7 +8,6 @@ module GovukPublishingComponents
|
|
8
8
|
related_guides
|
9
9
|
topics
|
10
10
|
collections
|
11
|
-
policies
|
12
11
|
topical_events
|
13
12
|
world_locations
|
14
13
|
statistical_data_sets
|
@@ -24,7 +23,6 @@ module GovukPublishingComponents
|
|
24
23
|
"related_guides" => related_guides,
|
25
24
|
"collections" => related_collections,
|
26
25
|
"topics" => related_topics,
|
27
|
-
"policies" => related_policies,
|
28
26
|
"topical_events" => related_topical_events,
|
29
27
|
"world_locations" => related_world_locations,
|
30
28
|
"statistical_data_sets" => related_statistical_data_sets,
|
@@ -106,11 +104,6 @@ module GovukPublishingComponents
|
|
106
104
|
end
|
107
105
|
end
|
108
106
|
|
109
|
-
def related_policies
|
110
|
-
policies = filter_link_type("related_policies", "policy")
|
111
|
-
build_links_for_sidebar(policies)
|
112
|
-
end
|
113
|
-
|
114
107
|
def related_statistical_data_sets
|
115
108
|
statistical_data_sets = filter_link_type("related_statistical_data_sets", "statistical_data_set")
|
116
109
|
build_links_for_sidebar(statistical_data_sets)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|