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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19f91260ea75a1db921c4b82de4aff1cceb0ed68
4
- data.tar.gz: 28253a57bee243f566f2588bf70325a44134f76b
3
+ metadata.gz: dd98f44e2c886c78e8b0c9e7467c9a77dccad1e8
4
+ data.tar.gz: 96ce348af177a0e5d5e36269cddfbfce2c9348ed
5
5
  SHA512:
6
- metadata.gz: c2406adc6eb2b21a485c910f05fcb9c531a3b82b96c631bfea410e377e2df028c164ac5bf4b9ce6ac00744a540eee47aae9589e98d6edb25d1486dda5d97dea8
7
- data.tar.gz: 00664e1d2ecce5b360899b158a1645d8c507519b2a1b80c2d5513ad4e81eefadbc4f91d64f856acc43655310e49888e18da5d39e5037f818fd704848e0a1e3bd
6
+ metadata.gz: 7559601ab14233815629647b7960669e9fcb2823b9c899a7dbff6e1d3009c1716017bbeb576422514dc272b6bce1c31eac73d89e4c9b00b04851030b136e877b
7
+ data.tar.gz: 80fb2fd0cac0b2593e4f57a4a5694ac4199aa798d79c27b253e910c42eedf981b1ee5863f7c7d9fe65e25872d4a93f6b5e97413fb6baf72b68a9824d07eaab12
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 3.2.1
2
+
3
+ * Add `is_page_parent` flag to the breadcrumb which is the direct parent of the
4
+ current taxon.
5
+
1
6
  ## 3.2.0
2
7
 
3
8
  * Alphabetically sort taxons and related links in the taxonomy sidebar.
@@ -5,11 +5,18 @@ module GovukNavigationHelpers
5
5
  end
6
6
 
7
7
  def breadcrumbs
8
- ordered_parents = all_parents.map do |parent|
9
- { title: parent.title, url: parent.base_path }
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 << { title: "Home", url: "/" }
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 }
@@ -1,3 +1,3 @@
1
1
  module GovukNavigationHelpers
2
- VERSION = "3.2.0".freeze
2
+ VERSION = "3.2.1".freeze
3
3
  end
@@ -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.0
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-08 00:00:00.000000000 Z
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