govuk_publishing_components 18.2.0 → 18.3.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/button.yml +9 -0
- data/app/views/govuk_publishing_components/components/docs/input.yml +5 -9
- data/lib/govuk_publishing_components/presenters/button_helper.rb +5 -1
- 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: 41819966f3acdcd91980fc9e8f51633caf134bc96333f053c0618e0f1306cd59
|
4
|
+
data.tar.gz: ad4486815abaab2fab8bfb56c8bcce37fb5384a8eab21997678dadf8cbd64d15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d311fd3a434bcbcda4a498279635be91c1942aefa6bbc68c7882a74e866856b173b320e809a265e936e724219e92bd32e315e8e8ff5b2608f1bac6707bc56dd3
|
7
|
+
data.tar.gz: 479d44fb2d1c2a0ce945b29e74bf80feaeb49feb048821a1b73af391f6c9eacaf849b74bc07a95707dd414be9fd8201fdaac8fb4755204c468717d43a2410bf1
|
@@ -98,4 +98,13 @@ examples:
|
|
98
98
|
data:
|
99
99
|
text: "Second button"
|
100
100
|
inline_layout: true
|
101
|
+
with_name_and_value_set:
|
102
|
+
description: |
|
103
|
+
By default, the button has no value or name set so it will not pass information when the form is submitted. This allows a name and value to be added so a button can add information to the form submission.
|
104
|
+
|
105
|
+
Please note that Internet Explorer 6 and 7 have **breaking bugs** when submitting a form with multiple buttons - this can [change what value is submitted by the button](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Notes). Make sure to check your user needs and browser usage.
|
106
|
+
data:
|
107
|
+
text: "This is the button text"
|
108
|
+
value: "this_is_the_value"
|
109
|
+
name: "this_is_the_name"
|
101
110
|
|
@@ -37,22 +37,18 @@ examples:
|
|
37
37
|
text: "Has an id"
|
38
38
|
name: "hasid"
|
39
39
|
id: "hasid"
|
40
|
-
|
40
|
+
with_aria_attributes:
|
41
41
|
description: |
|
42
|
-
|
42
|
+
The component accepts two possible aria attributes: aria-describedby and aria-controls.
|
43
43
|
|
44
|
-
|
44
|
+
[aria-describedby](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute) is used to indicate the ID of the element that describes the input. This will be overridden in the event of an error, where the error will be used for the describedby attribute value. This example uses the ID of the main container for demonstration purposes as there aren't any useful elements with IDs in the component guide. In real use this would be passed the ID of an element that correctly described the input.
|
45
|
+
|
46
|
+
aria-controls allows the addition of an aria-controls attribute, for use in places like the finders where the page is updated dynamically after value changes to the input.
|
45
47
|
data:
|
46
48
|
label:
|
47
49
|
text: "This is an example only and may not work with a screen reader"
|
48
50
|
name: "labelledby"
|
49
51
|
describedby: "wrapper"
|
50
|
-
aria_controls:
|
51
|
-
description: Allows the addition of an aria-controls attribute, for use in places like the finders where the page is updated dynamically after value changes to the input.
|
52
|
-
data:
|
53
|
-
label:
|
54
|
-
text: "This is an example only and will not work with a screen reader as intended"
|
55
|
-
name: "controls"
|
56
52
|
controls: "wrapper"
|
57
53
|
with_hint:
|
58
54
|
data:
|
@@ -5,7 +5,7 @@ module GovukPublishingComponents
|
|
5
5
|
class ButtonHelper
|
6
6
|
attr_reader :href, :text, :title, :info_text, :rel, :data_attributes,
|
7
7
|
:margin_bottom, :inline_layout, :target, :type, :start,
|
8
|
-
:secondary, :secondary_quiet, :destructive
|
8
|
+
:secondary, :secondary_quiet, :destructive, :name, :value
|
9
9
|
|
10
10
|
def initialize(local_assigns)
|
11
11
|
@href = local_assigns[:href]
|
@@ -22,6 +22,8 @@ module GovukPublishingComponents
|
|
22
22
|
@secondary = local_assigns[:secondary]
|
23
23
|
@secondary_quiet = local_assigns[:secondary_quiet]
|
24
24
|
@destructive = local_assigns[:destructive]
|
25
|
+
@name = local_assigns[:name]
|
26
|
+
@value = local_assigns[:value]
|
25
27
|
end
|
26
28
|
|
27
29
|
def link?
|
@@ -36,6 +38,8 @@ module GovukPublishingComponents
|
|
36
38
|
options[:data] = data_attributes if data_attributes
|
37
39
|
options[:title] = title if title
|
38
40
|
options[:target] = target if target
|
41
|
+
options[:name] = name if name.present? && value.present?
|
42
|
+
options[:value] = value if name.present? && value.present?
|
39
43
|
options
|
40
44
|
end
|
41
45
|
|
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: 18.
|
4
|
+
version: 18.3.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: 2019-08-
|
11
|
+
date: 2019-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|