govuk-components 3.1.1 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/components/govuk_component/breadcrumbs_component.rb +1 -1
- data/app/components/govuk_component/footer_component.rb +8 -3
- data/app/components/govuk_component/header_component.rb +1 -0
- data/app/components/govuk_component/start_button_component.rb +15 -6
- data/app/helpers/govuk_link_helper.rb +1 -1
- data/lib/govuk/components/version.rb +1 -1
- data/lib/govuk/components.rb +1 -0
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3840e40ffafa0fc239e251a1fd9f76c2bf6b290d0ea2f6df6a0dfd7300dd5f7
|
4
|
+
data.tar.gz: e0bbfa5d779cf3a40edce2b7282beb355738643098f50bb6a24dcb5c182a3548
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdf53c97e701ab06061022e6058e70a5bc8566cd5b6fb563c51c53c364d2d70281f2aea9883bafc8f7c510be4e3fbe478580cd3dd6496e00f774c7b9f5e4b044
|
7
|
+
data.tar.gz: 7b85bbcdd1f5f05fe12a1bacdd6a56e488428174976f1b92db1eb9cfb17e9487f3c569e14532c91e6f5611e94afff18251984200c8406345dd463f296f1421e9
|
@@ -65,9 +65,14 @@ private
|
|
65
65
|
def build_meta_links(links)
|
66
66
|
return [] if links.blank?
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
case links
|
69
|
+
when Array
|
70
|
+
links.map { |link| raw(link_to(link[:text], link[:href], class: %w(govuk-footer__link), **link.fetch(:attr, {}))) }
|
71
|
+
when Hash
|
72
|
+
links.map { |text, href| raw(link_to(text, href, class: %w(govuk-footer__link))) }
|
73
|
+
else
|
74
|
+
fail(ArgumentError, 'meta links must be a hash or array of hashes') unless links.is_a?(Hash)
|
75
|
+
end
|
71
76
|
end
|
72
77
|
|
73
78
|
def default_licence
|
@@ -1,29 +1,38 @@
|
|
1
1
|
class GovukComponent::StartButtonComponent < GovukComponent::Base
|
2
2
|
BUTTON_ATTRIBUTES = {
|
3
|
-
role: 'button',
|
4
3
|
draggable: 'false',
|
5
4
|
data: { module: 'govuk-button' }
|
6
5
|
}.freeze
|
7
6
|
|
8
|
-
|
7
|
+
LINK_ATTRIBUTES = BUTTON_ATTRIBUTES.merge({ role: 'button' }).freeze
|
9
8
|
|
10
|
-
|
9
|
+
attr_reader :text, :href, :as_button
|
10
|
+
|
11
|
+
def initialize(text:, href:, as_button: false, classes: [], html_attributes: {})
|
11
12
|
@text = text
|
12
13
|
@href = href
|
14
|
+
@as_button = as_button
|
13
15
|
|
14
16
|
super(classes: classes, html_attributes: html_attributes)
|
15
17
|
end
|
16
18
|
|
17
19
|
def call
|
18
|
-
|
19
|
-
|
20
|
+
if as_button
|
21
|
+
button_to(href, **html_attributes) do
|
22
|
+
safe_join([text, icon])
|
23
|
+
end
|
24
|
+
else
|
25
|
+
link_to(href, **html_attributes) do
|
26
|
+
safe_join([text, icon])
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
22
30
|
|
23
31
|
private
|
24
32
|
|
25
33
|
def default_attributes
|
26
|
-
|
34
|
+
(as_button ? BUTTON_ATTRIBUTES : LINK_ATTRIBUTES)
|
35
|
+
.merge({ class: %w(govuk-button govuk-button--start) })
|
27
36
|
end
|
28
37
|
|
29
38
|
def icon
|
@@ -68,7 +68,7 @@ module GovukLinkHelper
|
|
68
68
|
|
69
69
|
def govuk_button_link_to(name = nil, options = nil, extra_options = {}, &block)
|
70
70
|
extra_options = options if block_given?
|
71
|
-
html_options = GovukComponent::StartButtonComponent::
|
71
|
+
html_options = GovukComponent::StartButtonComponent::LINK_ATTRIBUTES
|
72
72
|
.merge build_html_options(extra_options, style: :button)
|
73
73
|
|
74
74
|
if block_given?
|
data/lib/govuk/components.rb
CHANGED
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: 3.1.
|
4
|
+
version: 3.1.4
|
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: 2022-
|
11
|
+
date: 2022-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.9.2
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: pagy
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 5.10.1
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 5.10.1
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: view_component
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,20 +240,6 @@ dependencies:
|
|
226
240
|
- - "~>"
|
227
241
|
- !ruby/object:Gem::Version
|
228
242
|
version: '4.11'
|
229
|
-
- !ruby/object:Gem::Dependency
|
230
|
-
name: pagy
|
231
|
-
requirement: !ruby/object:Gem::Requirement
|
232
|
-
requirements:
|
233
|
-
- - "~>"
|
234
|
-
- !ruby/object:Gem::Version
|
235
|
-
version: 5.10.1
|
236
|
-
type: :development
|
237
|
-
prerelease: false
|
238
|
-
version_requirements: !ruby/object:Gem::Requirement
|
239
|
-
requirements:
|
240
|
-
- - "~>"
|
241
|
-
- !ruby/object:Gem::Version
|
242
|
-
version: 5.10.1
|
243
243
|
- !ruby/object:Gem::Dependency
|
244
244
|
name: redcarpet
|
245
245
|
requirement: !ruby/object:Gem::Requirement
|
@@ -428,7 +428,7 @@ homepage: https://github.com/DFE-Digital/govuk-components
|
|
428
428
|
licenses:
|
429
429
|
- MIT
|
430
430
|
metadata: {}
|
431
|
-
post_install_message:
|
431
|
+
post_install_message:
|
432
432
|
rdoc_options: []
|
433
433
|
require_paths:
|
434
434
|
- lib
|
@@ -444,7 +444,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
444
444
|
version: '0'
|
445
445
|
requirements: []
|
446
446
|
rubygems_version: 3.1.6
|
447
|
-
signing_key:
|
447
|
+
signing_key:
|
448
448
|
specification_version: 4
|
449
449
|
summary: Lightweight set of reusable GOV.UK Design System components
|
450
450
|
test_files: []
|