govuk-components 2.1.1 → 2.1.2

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
  SHA256:
3
- metadata.gz: 2200643f294dd3059bece898a4eb5f3d39d185d57beedcd52cb995286c0b2e50
4
- data.tar.gz: 0d8d5f3fcec2c72493be6dc60af8d5d0987812dee91d0912c01b7ecfdf91a0b4
3
+ metadata.gz: a251ce9b412d46a7fd70155a08ba3cc2f6e9830baca832622bdeb459936b791f
4
+ data.tar.gz: 85cccf721573ce9c734d7156de9da9c1ceefc22cac05888d8163d9441420be7b
5
5
  SHA512:
6
- metadata.gz: 866ee06ca6a25f9336005987a5d86d2bd9d2dac1f05b93e1805477378b0588b80051421179f4986e0b4a7cbc6796af0e5cbb60b7661283a1151ef88ce2985f53
7
- data.tar.gz: 9ce92dde4cd348284b3542556703bc097ca8f0e650f0e38df805339e90d0cf496ab8c5c7cc06f20212ae3dd00c51bf64a9ce6d39d990bebd73556c68ac1fcb15
6
+ metadata.gz: c94357e58eee8a5ee0ae6e059f3177e340340d7af7cd19cfc3de607cc3b04e52d62e689a9291cc94ae568a1e1de809e224c566cb82a9b148986346773b45064b
7
+ data.tar.gz: 89494b6d782f7aaf2e4453fc317c917bb87e6dafabd21cd8b6d0d363ebba546ae2ffbdef43f129d8eaff875f0a3cd1b804a99f271f5a33779fca3ec8fddf2d0b
@@ -53,17 +53,20 @@ private
53
53
  end
54
54
 
55
55
  class NavigationItem < GovukComponent::Base
56
- attr_reader :text, :href, :active
56
+ attr_reader :text, :href, :options, :active
57
57
 
58
- def initialize(text:, href: nil, active: false, classes: [], html_attributes: {})
58
+ def initialize(text:, href: nil, options: {}, active: nil, classes: [], html_attributes: {})
59
59
  super(classes: classes, html_attributes: html_attributes)
60
60
 
61
- @text = text
62
- @href = href
63
- @active = active
61
+ @text = text
62
+ @href = href
63
+ @options = options
64
+ @active = active
64
65
  end
65
66
 
66
67
  def active?
68
+ return current_page?(href) if active.nil?
69
+
67
70
  active
68
71
  end
69
72
 
@@ -77,7 +80,7 @@ private
77
80
 
78
81
  def call
79
82
  if link?
80
- link_to(text, href, class: "govuk-header__link")
83
+ link_to(text, href, **options, class: "govuk-header__link")
81
84
  else
82
85
  text
83
86
  end
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '2.1.1'.freeze
3
+ VERSION = '2.1.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-14 00:00:00.000000000 Z
11
+ date: 2021-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -220,7 +220,7 @@ homepage: https://github.com/DFE-Digital/govuk-components
220
220
  licenses:
221
221
  - MIT
222
222
  metadata: {}
223
- post_install_message:
223
+ post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
226
226
  - lib
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  version: '0'
237
237
  requirements: []
238
238
  rubygems_version: 3.1.6
239
- signing_key:
239
+ signing_key:
240
240
  specification_version: 4
241
241
  summary: Lightweight set of reusable GOV.UK Design System components
242
242
  test_files: []