govuk_publishing_components 21.56.1 → 21.59.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +6 -1
  3. data/app/assets/javascripts/govuk_publishing_components/components/details.js +6 -4
  4. data/app/assets/javascripts/govuk_publishing_components/components/print-link.js +14 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +11 -5
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +4 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +9 -5
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_list.scss +1 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +52 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +7 -2
  12. data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +5 -1
  13. data/app/controllers/govuk_publishing_components/audit_controller.rb +52 -0
  14. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +1 -0
  15. data/app/models/govuk_publishing_components/audit_applications.rb +99 -0
  16. data/app/models/govuk_publishing_components/audit_comparer.rb +172 -0
  17. data/app/models/govuk_publishing_components/audit_components.rb +139 -0
  18. data/app/views/govuk_publishing_components/audit/show.html.erb +221 -0
  19. data/app/views/govuk_publishing_components/component_guide/index.html.erb +7 -4
  20. data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -0
  21. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +3 -1
  22. data/app/views/govuk_publishing_components/components/_input.html.erb +3 -4
  23. data/app/views/govuk_publishing_components/components/_list.html.erb +26 -0
  24. data/app/views/govuk_publishing_components/components/_print_link.html.erb +27 -0
  25. data/app/views/govuk_publishing_components/components/docs/action_link.yml +5 -0
  26. data/app/views/govuk_publishing_components/components/docs/input.yml +9 -1
  27. data/app/views/govuk_publishing_components/components/docs/list.yml +64 -0
  28. data/app/views/govuk_publishing_components/components/docs/print_link.yml +24 -0
  29. data/config/locales/en.yml +2 -0
  30. data/config/routes.rb +1 -0
  31. data/lib/govuk_publishing_components/version.rb +1 -1
  32. metadata +28 -2
@@ -0,0 +1,27 @@
1
+ <%
2
+ text ||= t('components.print_link.text')
3
+ href ||= nil
4
+ data_attributes ||= {}
5
+
6
+ require_js ||= href.nil?
7
+ data_attributes[:module] = 'print-link' if require_js
8
+ %>
9
+
10
+ <% if require_js %>
11
+ <div class="gem-c-print-link" >
12
+ <%= content_tag(:button, text, {
13
+ class: %w(gem-c-print-link__button govuk-link),
14
+ data: data_attributes
15
+ }) %>
16
+ </div>
17
+ <% else %>
18
+ <div class="gem-c-print-link gem-c-print-link--show-without-js">
19
+ <%= link_to(
20
+ text,
21
+ href,
22
+ class: %w(gem-c-print-link__link govuk-link),
23
+ rel: "alternate",
24
+ data: data_attributes
25
+ ) %>
26
+ </div>
27
+ <% end %>
@@ -75,6 +75,11 @@ examples:
75
75
  text: Getting financial help and keeping your business safe
76
76
  href: "/financial-help"
77
77
  simple: true
78
+ with_small_icon:
79
+ data:
80
+ text: Coronavirus (COVID-19)
81
+ href: "/my-test-page"
82
+ small_icon: true
78
83
  with_dark_icon:
79
84
  data:
80
85
  text: Coronavirus (COVID-19)
@@ -132,6 +132,14 @@ examples:
132
132
  text: "What is your name?"
133
133
  name: "name"
134
134
  heading_size: "l"
135
+ with_prefix:
136
+ description: To help users understand how the input should look like. Often used for units of measurement.
137
+ data:
138
+ label:
139
+ text: "Cost, in pounds"
140
+ name: "cost"
141
+ width: 10
142
+ prefix: "£"
135
143
  with_suffix:
136
144
  description: To help users understand how the input should look like. Often used for units of measurement.
137
145
  data:
@@ -145,7 +153,7 @@ examples:
145
153
  data:
146
154
  label:
147
155
  text: "Cost per item, in pounds"
148
- name: "Cost-per-item"
156
+ name: "cost-per-item"
149
157
  width: 10
150
158
  prefix: "£"
151
159
  suffix: "per item"
@@ -0,0 +1,64 @@
1
+ name: List
2
+ description: A list - unordered or ordered, with or without counters / bullet points.
3
+ body: |
4
+ This is an ordered or unordered list, with or without visible bullets / numbers.
5
+
6
+ The `items` parameter can include HTML to display - such as links or another
7
+ list. This HTML can either be directly coded or come from another component.
8
+ accessibility_criteria: |
9
+ The list must:
10
+
11
+ - inform the user how many items are in the list
12
+ - convey the content structure
13
+ - indicate the current page when contents span different pages, and not link to itself
14
+
15
+ The list may:
16
+
17
+ - include an `aria-label` to contextualise the list if helpful
18
+ govuk_frontend_components:
19
+ - list
20
+ examples:
21
+ default:
22
+ description: "The default is an unordered list with no bullet points or numbers."
23
+ data: &default-example-data
24
+ items:
25
+ - "Tony&rsquo;s Chocolonely"
26
+ - '<a href="https://en.wikipedia.org/wiki/Cherry_Ripe_(chocolate_bar)" rel="noopener" class="govuk-link">Cherry Ripe</a>'
27
+ - "Snickers"
28
+ - "Chomp"
29
+ - "Penguin"
30
+ - "Boost"
31
+ unordered_list_with_aria-label:
32
+ description: "A list with an aria-label"
33
+ data:
34
+ aria_label: "A list of delicious chocolate bars."
35
+ <<: *default-example-data
36
+ unordered_list_with_bullet_points:
37
+ description: "An unordered list with visible bullet points."
38
+ data:
39
+ visible_counters: true
40
+ <<: *default-example-data
41
+ ordered_list_without_numbers:
42
+ description: "This is an ordered list where the numbers aren't visible."
43
+ data:
44
+ list_type: "number"
45
+ <<: *default-example-data
46
+ ordered_list_with_numbers:
47
+ description: |
48
+ This is an ordered list with the numbers visible.
49
+ data:
50
+ list_type: "number"
51
+ visible_counters: true
52
+ <<: *default-example-data
53
+ with_extra_spacing:
54
+ description: |
55
+ Increases the amount of spacing between the list items.
56
+ data:
57
+ extra_spacing: true
58
+ <<: *default-example-data
59
+ with_id_attribute:
60
+ description: |
61
+ Sets the `id` on the `ul` or `ol` element.
62
+ data:
63
+ id: 'super-fantastic-chocolate-list'
64
+ <<: *default-example-data
@@ -0,0 +1,24 @@
1
+ name: Print link
2
+ description: A link with a print icon to help users print the current page
3
+ body: |
4
+ This component renders two different outputs depending on whether a `href` is specified. By default, when no `href` is given, the component renders as a button and triggers a print action via JavaScript. In this case the component is hidden in environments where JavaScript is disabled and can be used as a progressive enhancement. When a `href` is specified the component renders as an anchor tag and navigates to that `href` without JavaScript, suitable for applications which have paths that trigger a print event on load.
5
+ accessibility_criteria: |
6
+ - The print icon must be presentational and ignored by screen readers.
7
+ shared_accessibility_criteria:
8
+ - link
9
+ examples:
10
+ default:
11
+ description: This component calls `print()` via the browser's DOM API. By default it relies on JavaScript and is not shown in environments where JavaScript is disabled. The \"link\" here is actually a button tag because this is not a navigation event.
12
+ with_different_text:
13
+ data:
14
+ text: "Print this manual"
15
+ with_different_href:
16
+ description: You can specify a alternative `href` URL that will override the default behaviour. When a `href` is specified the print link will render as an anchor tag and be displayed even when JavaScript is disabled.
17
+ data:
18
+ href: "/print"
19
+ with_data_attributes:
20
+ data:
21
+ data_attributes:
22
+ track-category: "printButton"
23
+ track-action: "clicked"
24
+ track-label: "Print this page"
@@ -58,6 +58,8 @@ en:
58
58
  policies: "Policies"
59
59
  statistical_data_sets: "Statistical data sets"
60
60
  topical_events: "Topical events"
61
+ print_link:
62
+ text: "Print this page"
61
63
  skip_link:
62
64
  text: "Skip to main content"
63
65
  step_by_step_nav:
@@ -1,4 +1,5 @@
1
1
  GovukPublishingComponents::Engine.routes.draw do
2
+ get "/audit" => "audit#show", as: :audit
2
3
  root to: "component_guide#index", as: :component_guide
3
4
  get ":component/preview" => "component_guide#preview", as: :component_preview_all
4
5
  get ":component/:example/preview" => "component_guide#preview", as: :component_preview
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "21.56.1".freeze
2
+ VERSION = "21.59.0".freeze
3
3
  end
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: 21.56.1
4
+ version: 21.59.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: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: 3.5.1
209
+ - !ruby/object:Gem::Dependency
210
+ name: jasmine_selenium_runner
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 3.0.0
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 3.0.0
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: pry-byebug
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -437,6 +451,7 @@ files:
437
451
  - app/assets/javascripts/govuk_publishing_components/components/header.js
438
452
  - app/assets/javascripts/govuk_publishing_components/components/initial-focus.js
439
453
  - app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js
454
+ - app/assets/javascripts/govuk_publishing_components/components/print-link.js
440
455
  - app/assets/javascripts/govuk_publishing_components/components/radio.js
441
456
  - app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js
442
457
  - app/assets/javascripts/govuk_publishing_components/components/tabs.js
@@ -497,6 +512,7 @@ files:
497
512
  - app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss
498
513
  - app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss
499
514
  - app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss
515
+ - app/assets/stylesheets/govuk_publishing_components/components/_list.scss
500
516
  - app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss
501
517
  - app/assets/stylesheets/govuk_publishing_components/components/_modal-dialogue.scss
502
518
  - app/assets/stylesheets/govuk_publishing_components/components/_notice.scss
@@ -504,6 +520,7 @@ files:
504
520
  - app/assets/stylesheets/govuk_publishing_components/components/_panel.scss
505
521
  - app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss
506
522
  - app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss
523
+ - app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss
507
524
  - app/assets/stylesheets/govuk_publishing_components/components/_radio.scss
508
525
  - app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss
509
526
  - app/assets/stylesheets/govuk_publishing_components/components/_search.scss
@@ -580,12 +597,17 @@ files:
580
597
  - app/assets/stylesheets/govuk_publishing_components/components/print/_translation-nav.scss
581
598
  - app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss
582
599
  - app/controllers/govuk_publishing_components/application_controller.rb
600
+ - app/controllers/govuk_publishing_components/audit_controller.rb
583
601
  - app/controllers/govuk_publishing_components/component_guide_controller.rb
584
602
  - app/helpers/govuk_publishing_components/application_helper.rb
603
+ - app/models/govuk_publishing_components/audit_applications.rb
604
+ - app/models/govuk_publishing_components/audit_comparer.rb
605
+ - app/models/govuk_publishing_components/audit_components.rb
585
606
  - app/models/govuk_publishing_components/component_doc.rb
586
607
  - app/models/govuk_publishing_components/component_docs.rb
587
608
  - app/models/govuk_publishing_components/component_example.rb
588
609
  - app/models/govuk_publishing_components/shared_accessibility_criteria.rb
610
+ - app/views/govuk_publishing_components/audit/show.html.erb
589
611
  - app/views/govuk_publishing_components/component_guide/_application_stylesheet.html.erb
590
612
  - app/views/govuk_publishing_components/component_guide/component_doc/_call.html.erb
591
613
  - app/views/govuk_publishing_components/component_guide/component_doc/_component.html.erb
@@ -638,6 +660,7 @@ files:
638
660
  - app/views/govuk_publishing_components/components/_layout_for_admin.html.erb
639
661
  - app/views/govuk_publishing_components/components/_layout_header.html.erb
640
662
  - app/views/govuk_publishing_components/components/_lead_paragraph.html.erb
663
+ - app/views/govuk_publishing_components/components/_list.html.erb
641
664
  - app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb
642
665
  - app/views/govuk_publishing_components/components/_meta_tags.html.erb
643
666
  - app/views/govuk_publishing_components/components/_metadata.html.erb
@@ -647,6 +670,7 @@ files:
647
670
  - app/views/govuk_publishing_components/components/_panel.html.erb
648
671
  - app/views/govuk_publishing_components/components/_phase_banner.html.erb
649
672
  - app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb
673
+ - app/views/govuk_publishing_components/components/_print_link.html.erb
650
674
  - app/views/govuk_publishing_components/components/_radio.html.erb
651
675
  - app/views/govuk_publishing_components/components/_related_navigation.html.erb
652
676
  - app/views/govuk_publishing_components/components/_search.html.erb
@@ -713,6 +737,7 @@ files:
713
737
  - app/views/govuk_publishing_components/components/docs/layout_for_admin.yml
714
738
  - app/views/govuk_publishing_components/components/docs/layout_header.yml
715
739
  - app/views/govuk_publishing_components/components/docs/lead_paragraph.yml
740
+ - app/views/govuk_publishing_components/components/docs/list.yml
716
741
  - app/views/govuk_publishing_components/components/docs/machine_readable_metadata.yml
717
742
  - app/views/govuk_publishing_components/components/docs/meta_tags.yml
718
743
  - app/views/govuk_publishing_components/components/docs/metadata.yml
@@ -722,6 +747,7 @@ files:
722
747
  - app/views/govuk_publishing_components/components/docs/panel.yml
723
748
  - app/views/govuk_publishing_components/components/docs/phase_banner.yml
724
749
  - app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml
750
+ - app/views/govuk_publishing_components/components/docs/print_link.yml
725
751
  - app/views/govuk_publishing_components/components/docs/radio.yml
726
752
  - app/views/govuk_publishing_components/components/docs/related_navigation.yml
727
753
  - app/views/govuk_publishing_components/components/docs/search.yml