govuk_navigation_helpers 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/govuk_navigation_helpers/taxon_breadcrumbs.rb +10 -3
- data/lib/govuk_navigation_helpers/version.rb +1 -1
- data/spec/taxon_breadcrumbs_spec.rb +11 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd98f44e2c886c78e8b0c9e7467c9a77dccad1e8
|
4
|
+
data.tar.gz: 96ce348af177a0e5d5e36269cddfbfce2c9348ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7559601ab14233815629647b7960669e9fcb2823b9c899a7dbff6e1d3009c1716017bbeb576422514dc272b6bce1c31eac73d89e4c9b00b04851030b136e877b
|
7
|
+
data.tar.gz: 80fb2fd0cac0b2593e4f57a4a5694ac4199aa798d79c27b253e910c42eedf981b1ee5863f7c7d9fe65e25872d4a93f6b5e97413fb6baf72b68a9824d07eaab12
|
data/CHANGELOG.md
CHANGED
@@ -5,11 +5,18 @@ module GovukNavigationHelpers
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def breadcrumbs
|
8
|
-
ordered_parents = all_parents.map do |parent|
|
9
|
-
{
|
8
|
+
ordered_parents = all_parents.map.with_index do |parent, index|
|
9
|
+
{
|
10
|
+
title: parent.title,
|
11
|
+
url: parent.base_path,
|
12
|
+
is_page_parent: index == 0
|
13
|
+
}
|
10
14
|
end
|
11
15
|
|
12
|
-
ordered_parents << {
|
16
|
+
ordered_parents << {
|
17
|
+
title: "Home",
|
18
|
+
url: "/",
|
19
|
+
is_page_parent: ordered_parents.empty? }
|
13
20
|
|
14
21
|
ordered_breadcrumbs = ordered_parents.reverse
|
15
22
|
ordered_breadcrumbs << { title: content_item.title, is_current_page: true }
|
@@ -21,7 +21,7 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
|
|
21
21
|
|
22
22
|
expect(breadcrumbs).to eq(
|
23
23
|
breadcrumbs: [
|
24
|
-
{ title: "Home", url: "/" },
|
24
|
+
{ title: "Home", url: "/", is_page_parent: true },
|
25
25
|
{ title: "Some Content", is_current_page: true }
|
26
26
|
]
|
27
27
|
)
|
@@ -33,8 +33,8 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
|
|
33
33
|
|
34
34
|
expect(breadcrumbs).to eq(
|
35
35
|
breadcrumbs: [
|
36
|
-
{ title: "Home", url: "/" },
|
37
|
-
{ title: "Taxon", url: "/taxon" },
|
36
|
+
{ title: "Home", url: "/", is_page_parent: false },
|
37
|
+
{ title: "Taxon", url: "/taxon", is_page_parent: true },
|
38
38
|
{ title: "Some Content", is_current_page: true },
|
39
39
|
]
|
40
40
|
)
|
@@ -64,10 +64,10 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
|
|
64
64
|
|
65
65
|
expect(breadcrumbs).to eq(
|
66
66
|
breadcrumbs: [
|
67
|
-
{ title: "Home", url: "/" },
|
68
|
-
{ title: "Another-parent", url: "/another-parent" },
|
69
|
-
{ title: "A-parent", url: "/a-parent" },
|
70
|
-
{ title: "Taxon", url: "/taxon" },
|
67
|
+
{ title: "Home", url: "/", is_page_parent: false },
|
68
|
+
{ title: "Another-parent", url: "/another-parent", is_page_parent: false },
|
69
|
+
{ title: "A-parent", url: "/a-parent", is_page_parent: false },
|
70
|
+
{ title: "Taxon", url: "/taxon", is_page_parent: true },
|
71
71
|
{ title: "Some Content", is_current_page: true },
|
72
72
|
]
|
73
73
|
)
|
@@ -91,8 +91,8 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
|
|
91
91
|
|
92
92
|
expect(breadcrumbs).to eq(
|
93
93
|
breadcrumbs: [
|
94
|
-
{ title: "Home", url: "/" },
|
95
|
-
{ title: "A-parent", url: "/a-parent" },
|
94
|
+
{ title: "Home", url: "/", is_page_parent: false },
|
95
|
+
{ title: "A-parent", url: "/a-parent", is_page_parent: true },
|
96
96
|
{ title: "Taxon", is_current_page: true },
|
97
97
|
]
|
98
98
|
)
|
@@ -125,8 +125,8 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
|
|
125
125
|
|
126
126
|
expect(breadcrumbs).to eq(
|
127
127
|
breadcrumbs: [
|
128
|
-
{ title: "Home", url: "/" },
|
129
|
-
{ title: "Parent A", url: "/parent-a" },
|
128
|
+
{ title: "Home", url: "/", is_page_parent: false },
|
129
|
+
{ title: "Parent A", url: "/parent-a", is_page_parent: true },
|
130
130
|
{ title: "Taxon", is_current_page: true },
|
131
131
|
]
|
132
132
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_navigation_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
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: 2017-03-
|
11
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|