govuk_publishing_components 4.1.1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/current-location.js +1 -1
  3. data/app/assets/javascripts/govuk_publishing_components/components/{task-list.js → step-by-step-nav.js} +42 -45
  4. data/app/assets/javascripts/history-support.js +1 -1
  5. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +3 -3
  6. data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +2 -2
  7. data/app/assets/stylesheets/govuk_publishing_components/component_guide_print.scss +3 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/{_task-list-header.scss → _step-by-step-nav-header.scss} +4 -4
  9. data/app/assets/stylesheets/govuk_publishing_components/components/{_task-list-related.scss → _step-by-step-nav-related.scss} +7 -7
  10. data/app/assets/stylesheets/govuk_publishing_components/components/{_task-list.scss → _step-by-step-nav.scss} +118 -131
  11. data/app/assets/stylesheets/govuk_publishing_components/components/print/{_task-list-header.scss → _step-by-step-nav-header.scss} +3 -3
  12. data/app/assets/stylesheets/govuk_publishing_components/components/print/{_task-list.scss → _step-by-step-nav.scss} +20 -20
  13. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +100 -0
  14. data/app/views/govuk_publishing_components/components/{_task_list_header.html.erb → _step_by_step_nav_header.html.erb} +7 -7
  15. data/app/views/govuk_publishing_components/components/{_task_list_related.html.erb → _step_by_step_nav_related.html.erb} +10 -10
  16. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +1041 -0
  17. data/app/views/govuk_publishing_components/components/docs/{task_list_header.yml → step_by_step_nav_header.yml} +7 -7
  18. data/app/views/govuk_publishing_components/components/docs/{task_list_related.yml → step_by_step_nav_related.yml} +5 -5
  19. data/config/locales/en.yml +2 -0
  20. data/lib/govuk_publishing_components.rb +1 -1
  21. data/lib/govuk_publishing_components/components/{task_list_helper.rb → step_by_step_nav_helper.rb} +13 -13
  22. data/lib/govuk_publishing_components/version.rb +1 -1
  23. metadata +15 -15
  24. data/app/views/govuk_publishing_components/components/_task_list.html.erb +0 -105
  25. data/app/views/govuk_publishing_components/components/docs/task_list.yml +0 -1085
@@ -1,13 +1,13 @@
1
- name: Task list header
2
- description: Shows that a content page is part of a task list.
1
+ name: Step by step navigation header
2
+ description: Shows that a content page is part of a step by step navigation
3
3
  body: |
4
- The component indicates to the user that the current page is part of a [task list](/component-guide/task_list), and can provide a link to that task list.
4
+ The component indicates to the user that the current page is part of a [step by step navigation](/component-guide/step_by_step_nav), and can provide a link to it.
5
5
  accessibility_criteria: |
6
6
  The component is designed to go into the top of an existing content page and should not interfere with the heading structure of the page, so therefore should not contain a heading tag.
7
7
 
8
8
  The component must:
9
9
 
10
- - provide a skip link to the task list on the page, if that task list is present
10
+ - provide a skip link to the step by step navigation on the page, if one is present
11
11
  shared_accessibility_criteria:
12
12
  - link
13
13
  examples:
@@ -19,15 +19,15 @@ examples:
19
19
  title: 'Having children: step by step'
20
20
  path: /childcare-parenting/pregnancy-and-birth
21
21
  with_a_skip_link:
22
- description: This option allows the insertion of a skip link to a task list elsewhere on the page. This aids navigation when using a keyboard or screen reader. The skip link is visually hidden until it receives focus.
22
+ description: This option allows the insertion of a skip link to a step by step navigation elsewhere on the page. This aids navigation when using a keyboard or screen reader. The skip link is visually hidden until it receives focus.
23
23
  data:
24
24
  title: 'Separating from a spouse or civil partner: step by step'
25
25
  path: /divorce
26
- skip_link: '#task-list-wrapper'
26
+ skip_link: '#step-nav-wrapper'
27
27
  with_a_skip_link_with_custom_text:
28
28
  description: It's hard to think of good text to put in a skip link, so this option lets you customise it.
29
29
  data:
30
30
  title: 'Buying and renting a property: step by step'
31
31
  path: /buy-sell-your-home
32
- skip_link: '#task-list-steps'
32
+ skip_link: '#step-nav-steps'
33
33
  skip_link_text: Skip to steps
@@ -1,12 +1,12 @@
1
- name: Task list related links
2
- description: Links to task lists that a page is part of
1
+ name: Step by step navigation related links
2
+ description: Links to step by step navigations that a page is part of
3
3
  body: |
4
- The component is designed to go on a content page to accompany a small task list in a sidebar. It provides links to the main task list page.
4
+ The component is designed to go on a content page to accompany a small step by step navigation in a sidebar. It provides links to one or more step by step navigation pages.
5
5
 
6
6
  The component has two uses:
7
7
 
8
- - above the task list, it provides a link to the main task list page
9
- - below the task list, it shows and links to any other task lists that this page belongs to
8
+ - above the step by step navigation sidebar, it provides a link to the main step by step navigation
9
+ - below the step by step navigation sidebar, it shows and links to any other step by step navigations that this page belongs to
10
10
 
11
11
  In the first use case, only one link should be present and the entire text of the component should be contained in a heading. In the second use case, if more than one link is provided, the links should be shown in a list, separate from the heading.
12
12
  accessibility_criteria: |
@@ -25,3 +25,5 @@ en:
25
25
  or: 'or'
26
26
  back_link:
27
27
  back: 'Back'
28
+ step_by_step_nav_related:
29
+ part_of: "Part of"
@@ -1,6 +1,6 @@
1
1
  require "govuk_publishing_components/config"
2
2
  require "govuk_publishing_components/engine"
3
- require "govuk_publishing_components/components/task_list_helper"
3
+ require "govuk_publishing_components/components/step_by_step_nav_helper"
4
4
 
5
5
  module GovukPublishingComponents
6
6
  end
@@ -1,8 +1,8 @@
1
- class TaskListHelper
1
+ class StepNavHelper
2
2
  include ActionView::Helpers
3
3
  include ActionView::Context
4
4
 
5
- def render_task_list_element(element, options)
5
+ def render_step_nav_element(element, options)
6
6
  @options = options
7
7
  @link_index = options[:link_index]
8
8
 
@@ -17,7 +17,7 @@ class TaskListHelper
17
17
  end
18
18
 
19
19
  # id should be lowercase, contain only numbers and letters and replace spaces with dashes
20
- def generate_task_list_id(step_title)
20
+ def generate_step_nav_id(step_title)
21
21
  step_title.downcase.tr(" ", "-").gsub(/[^a-z0-9\-\s]/i, '')
22
22
  end
23
23
 
@@ -27,7 +27,7 @@ private
27
27
  content_tag(
28
28
  :p,
29
29
  text,
30
- class: "gem-c-task-list__paragraph"
30
+ class: "gem-c-step-nav__paragraph"
31
31
  )
32
32
  end
33
33
 
@@ -35,14 +35,14 @@ private
35
35
  content_tag(
36
36
  "h#{@options[:heading_level] + 1}",
37
37
  text,
38
- class: "gem-c-task-list__heading"
38
+ class: "gem-c-step-nav__heading"
39
39
  )
40
40
  end
41
41
 
42
42
  def list(element)
43
43
  content_tag(
44
44
  get_list_element(element[:style]),
45
- class: "gem-c-task-list__links #{get_list_style(element[:style])}",
45
+ class: "gem-c-step-nav__links #{get_list_style(element[:style])}",
46
46
  data: {
47
47
  length: element[:contents].length
48
48
  }
@@ -51,7 +51,7 @@ private
51
51
  concat(
52
52
  content_tag(
53
53
  :li,
54
- class: "gem-c-task-list__link js-list-item #{link_active(contents[:active])}"
54
+ class: "gem-c-step-nav__link js-list-item #{link_active(contents[:active])}"
55
55
  ) do
56
56
  create_list_item_content(contents)
57
57
  end
@@ -70,9 +70,9 @@ private
70
70
  href,
71
71
  rel: ("external" if href.start_with?('http')),
72
72
  data: {
73
- position: "#{@options[:group_index] + 1}.#{@options[:step_index] + 1}.#{@link_index}"
73
+ position: "#{@options[:step_index] + 1}.#{@link_index}"
74
74
  },
75
- class: "gem-c-task-list__link-item js-link"
75
+ class: "gem-c-step-nav__link-item js-link"
76
76
  ) do
77
77
  text
78
78
  end
@@ -82,14 +82,14 @@ private
82
82
  end
83
83
 
84
84
  def create_context(context)
85
- content_tag(:span, context, class: "gem-c-task-list__context") if context
85
+ content_tag(:span, context, class: "gem-c-step-nav__context") if context
86
86
  end
87
87
 
88
88
  def get_list_style(style)
89
89
  if style == "required"
90
- "gem-c-task-list__links--required"
90
+ "gem-c-step-nav__links--required"
91
91
  elsif style == "choice"
92
- "gem-c-task-list__links--choice"
92
+ "gem-c-step-nav__links--choice"
93
93
  end
94
94
  end
95
95
 
@@ -106,6 +106,6 @@ private
106
106
  end
107
107
 
108
108
  def link_active(active)
109
- "gem-c-task-list__link--active" if active
109
+ "gem-c-step-nav__link--active" if active
110
110
  end
111
111
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '4.1.1'.freeze
2
+ VERSION = '5.0.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: 4.1.1
4
+ version: 5.0.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: 2018-02-02 00:00:00.000000000 Z
11
+ date: 2018-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -250,7 +250,7 @@ files:
250
250
  - app/assets/javascripts/govuk_publishing_components/accessibility-test.js
251
251
  - app/assets/javascripts/govuk_publishing_components/application.js
252
252
  - app/assets/javascripts/govuk_publishing_components/components/error-summary.js
253
- - app/assets/javascripts/govuk_publishing_components/components/task-list.js
253
+ - app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js
254
254
  - app/assets/javascripts/govuk_publishing_components/vendor/axe.min.js
255
255
  - app/assets/javascripts/govuk_publishing_components/vendor/matches-polyfill.min.js
256
256
  - app/assets/javascripts/govuk_publishing_components/visual-regression.js
@@ -265,14 +265,14 @@ files:
265
265
  - app/assets/stylesheets/govuk_publishing_components/components/_input.scss
266
266
  - app/assets/stylesheets/govuk_publishing_components/components/_label.scss
267
267
  - app/assets/stylesheets/govuk_publishing_components/components/_radio.scss
268
- - app/assets/stylesheets/govuk_publishing_components/components/_task-list-header.scss
269
- - app/assets/stylesheets/govuk_publishing_components/components/_task-list-related.scss
270
- - app/assets/stylesheets/govuk_publishing_components/components/_task-list.scss
268
+ - app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss
269
+ - app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss
270
+ - app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss
271
271
  - app/assets/stylesheets/govuk_publishing_components/components/helpers/_clearfix.scss
272
272
  - app/assets/stylesheets/govuk_publishing_components/components/helpers/_px-to-em.scss
273
273
  - app/assets/stylesheets/govuk_publishing_components/components/helpers/_variables.scss
274
- - app/assets/stylesheets/govuk_publishing_components/components/print/_task-list-header.scss
275
- - app/assets/stylesheets/govuk_publishing_components/components/print/_task-list.scss
274
+ - app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss
275
+ - app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss
276
276
  - app/controllers/govuk_publishing_components/application_controller.rb
277
277
  - app/controllers/govuk_publishing_components/component_guide_controller.rb
278
278
  - app/helpers/govuk_publishing_components/application_helper.rb
@@ -293,18 +293,18 @@ files:
293
293
  - app/views/govuk_publishing_components/components/_input.html.erb
294
294
  - app/views/govuk_publishing_components/components/_label.html.erb
295
295
  - app/views/govuk_publishing_components/components/_radio.html.erb
296
- - app/views/govuk_publishing_components/components/_task_list.html.erb
297
- - app/views/govuk_publishing_components/components/_task_list_header.html.erb
298
- - app/views/govuk_publishing_components/components/_task_list_related.html.erb
296
+ - app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb
297
+ - app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb
298
+ - app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
299
299
  - app/views/govuk_publishing_components/components/docs/back_link.yml
300
300
  - app/views/govuk_publishing_components/components/docs/error_summary.yml
301
301
  - app/views/govuk_publishing_components/components/docs/fieldset.yml
302
302
  - app/views/govuk_publishing_components/components/docs/input.yml
303
303
  - app/views/govuk_publishing_components/components/docs/label.yml
304
304
  - app/views/govuk_publishing_components/components/docs/radio.yml
305
- - app/views/govuk_publishing_components/components/docs/task_list.yml
306
- - app/views/govuk_publishing_components/components/docs/task_list_header.yml
307
- - app/views/govuk_publishing_components/components/docs/task_list_related.yml
305
+ - app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml
306
+ - app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml
307
+ - app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml
308
308
  - app/views/layouts/govuk_publishing_components/application.html.erb
309
309
  - config/initializers/assets.rb
310
310
  - config/locales/cy.yml
@@ -316,7 +316,7 @@ files:
316
316
  - lib/generators/govuk_publishing_components/templates/_component.scss
317
317
  - lib/generators/govuk_publishing_components/templates/component.yml.erb
318
318
  - lib/govuk_publishing_components.rb
319
- - lib/govuk_publishing_components/components/task_list_helper.rb
319
+ - lib/govuk_publishing_components/components/step_by_step_nav_helper.rb
320
320
  - lib/govuk_publishing_components/config.rb
321
321
  - lib/govuk_publishing_components/engine.rb
322
322
  - lib/govuk_publishing_components/minitest/component_guide_test.rb
@@ -1,105 +0,0 @@
1
- <%
2
- options = {}
3
- options[:heading_level] = heading_level ||= 2
4
-
5
- groups ||= false
6
- small ||= false
7
- show_step ||= false
8
- remember_last_step ||= false
9
- task_list_url ||= false
10
- task_list_url_link_text ||= "Get help completing this step"
11
- highlight_group ||= false
12
-
13
- step_count = 0
14
- %>
15
- <% if groups %>
16
- <div
17
- data-module="gemtasklist"
18
- class="gem-c-task-list js-hidden <% unless small %>gem-c-task-list--large<% end %>"
19
- <% if remember_last_step %>data-remember<% end %>
20
- >
21
- <ol class="gem-c-task-list__groups">
22
- <% groups.each_with_index do |group, group_index| %>
23
- <%
24
- group_is_active = group_index + 1 == highlight_group
25
- %>
26
- <li class="gem-c-task-list__group <%= 'gem-c-task-list__group--active' if group_is_active %>" <% if group_is_active %>aria-current="step"<% end %>>
27
- <span class="gem-c-task-list__circle gem-c-task-list__circle--number">
28
- <span class="gem-c-task-list__circle-inner">
29
- <span class="gem-c-task-list__circle-background">
30
- <span class="visuallyhidden">Step</span> <%= group_index + 1 %>
31
- </span>
32
- </span>
33
- </span>
34
-
35
- <% group.each_with_index do |step, step_index| %>
36
- <%
37
- step_count += 1
38
- id = TaskListHelper.new.generate_task_list_id(step[:title])
39
-
40
- logic = "and"
41
- logic = step[:logic] if ["and", "or"].include? step[:logic]
42
- %>
43
- <div
44
- class="gem-c-task-list__step js-step <%= "gem-c-task-list__step--optional" if step[:optional] %>"
45
- id="<%= id %>"
46
- data-track-count="tasklistSection"
47
- <%= "data-show" if step_count == show_step %>
48
- >
49
- <% if step_index > 0 %>
50
- <div class="gem-c-task-list__circle gem-c-task-list__circle--logic">
51
- <span class="gem-c-task-list__circle-inner">
52
- <span class="gem-c-task-list__circle-background">
53
- <%= logic %>
54
- </span>
55
- </span>
56
- </div>
57
- <% end %>
58
-
59
- <div class="gem-c-task-list__header js-toggle-panel" data-position="<%= "#{group_index + 1}.#{step_index + 1}" %>">
60
- <%= content_tag("h#{heading_level}", step[:title], class: 'gem-c-task-list__title js-step-title') %>
61
- </div>
62
-
63
- <div class="gem-c-task-list__panel js-panel" id="step-panel-<%= id %>-<%= step_index + 1 %>">
64
- <%
65
- in_substep = false
66
- options[:group_index] = group_index
67
- options[:step_index] = step_index
68
- options[:link_index] = 0
69
- %>
70
- <% step[:contents].each do |element| %>
71
- <%= TaskListHelper.new.render_task_list_element(element, options) %>
72
- <%
73
- if element[:type] == 'list'
74
- options[:link_index] += element[:contents].length
75
- end
76
- %>
77
-
78
- <% if element[:type] == 'substep' %>
79
- <% if in_substep %>
80
- </div>
81
- <% in_substep = false %>
82
- <% end %>
83
- <div class="gem-c-task-list__substep <% if element[:optional] %>gem-c-task-list__substep--optional<% end %>">
84
- <% in_substep = true %>
85
- <% end %>
86
- <% end %>
87
-
88
- <% if in_substep %>
89
- </div>
90
- <% end %>
91
-
92
- <% if task_list_url && step[:show_help_link] %>
93
- <div class="gem-c-task-list__help">
94
- <a href="<%= task_list_url %>#<%= id %>" class="gem-c-task-list__help-link js-link" data-position="get-help"><%= task_list_url_link_text %></a>
95
- </div>
96
- <% end %>
97
- </div>
98
-
99
- </div>
100
- <% end %>
101
- </li>
102
- <% end %>
103
- </ol>
104
- </div>
105
- <% end %>
@@ -1,1085 +0,0 @@
1
- name: Task list
2
- description: Numbered groups containing expanding/collapsing steps
3
- body: |
4
- Task lists are designed to show a sequence of steps towards a specific goal, such as 'learning to drive'. Each group of a task list can contain one or more steps. Each step can contain one or more links to pages. User research suggested that each step should be collapsed by default so that users are not overwhelmed with information.
5
-
6
- If JavaScript is disabled the task list expands fully. All of the task list functionality (including the icons and aria attributes) are added using JavaScript.
7
-
8
- The task list is based on the accordion component in collections, but has been altered. This is for two reasons.
9
-
10
- - task lists are needed throughout GOV.UK and extending the accordion to be the task list would require promoting it to static, which would break integration testing
11
- - creating a new component allows further iteration without impacting the accordion
12
- accessibility_criteria: |
13
- The task list must:
14
-
15
- - indicate to users that each step can be expanded and collapsed
16
- - inform the user when a step has been expanded or collapsed
17
- - be usable with a keyboard
18
- - allow users to show or hide all steps at once
19
- - inform the user which step a link belongs to
20
- - inform the user which step the current page is in, particularly where there are multiple steps in one group
21
- - be readable when only the text of the page is zoomed - achieved for the numbers and logic elements by their text being wrapped in several elements that give them a white background and ensure the text when zoomed expands to the left, not to the right, where it would obscure the step titles
22
-
23
- The show/hide all button only needs to list the first panel id in the aria-controls attribute, rather than all of them.
24
-
25
- Step headings must use a button element:
26
-
27
- - so that steps can be toggled with the space and enter keys
28
- - so that steps can't be opened in a new tab or window
29
-
30
- When JavaScript is unavailable the task list must:
31
-
32
- - be fully expanded
33
- - not be marked as expandable
34
- shared_accessibility_criteria:
35
- - link
36
- examples:
37
- default:
38
- data:
39
- groups: [
40
- [
41
- {
42
- title: "Do a thing",
43
- contents: [
44
- {
45
- type: 'paragraph',
46
- text: 'This is a paragraph of text.'
47
- },
48
- {
49
- type: 'paragraph',
50
- text: 'This is also a paragraph of text that intentionally contains lots of words in order to fill the width of the page successfully to check layout and so forth.'
51
- }
52
- ]
53
- },
54
- {
55
- title: "Do another thing",
56
- contents: [
57
- {
58
- type: 'paragraph',
59
- text: 'Groups can contain multiple steps, like this.'
60
- },
61
- ]
62
- }
63
- ],
64
- [
65
- {
66
- title: "Do something else",
67
- contents: [
68
- {
69
- type: 'paragraph',
70
- text: 'This is yet another paragraph.'
71
- }
72
- ]
73
- }
74
- ]
75
- ]
76
- with_a_different_heading_level:
77
- description: Steps have a H2 by default, but this can be changed. The heading level does not change any styling.
78
- data:
79
- heading_level: 3
80
- groups: [
81
- [
82
- {
83
- title: 'This is a heading 3',
84
- contents: [
85
- {
86
- type: 'paragraph',
87
- text: 'This is yet another paragraph.'
88
- }
89
- ]
90
- }
91
- ],
92
- [
93
- {
94
- title: 'This is also a heading 3',
95
- contents: [
96
- {
97
- type: 'paragraph',
98
- text: 'This is yet another paragraph.'
99
- }
100
- ]
101
- }
102
- ]
103
- ]
104
- open_a_step_by_default:
105
- description: Pass the index of the step to open by default. This is the nth step, regardless of group number.
106
- data:
107
- show_step: 3
108
- groups: [
109
- [
110
- {
111
- title: 'Closed by default',
112
- contents: [
113
- {
114
- type: 'paragraph',
115
- text: 'Well, open now, obviously.'
116
- }
117
- ]
118
- }
119
- ],
120
- [
121
- {
122
- title: 'Also closed by default',
123
- contents: [
124
- {
125
- type: 'paragraph',
126
- text: 'Hello.'
127
- }
128
- ]
129
- },
130
- {
131
- title: 'Open by default',
132
- contents: [
133
- {
134
- type: 'paragraph',
135
- text: 'Hello!'
136
- }
137
- ]
138
- }
139
- ]
140
- ]
141
- remember_last_opened_step:
142
- description: |
143
- If a step is opened its ID is appended to the end of the URL, so that if the URL is shared or the 'back' button is used, that step will be opened on page load. This was historically part of the behaviour of the accordion. By default this is turned off and cannot be used together with the option to open a step by default.
144
-
145
- This behaviour is used with the 'links to more information' option.
146
- data:
147
- remember_last_step: true
148
- groups: [
149
- [
150
- {
151
- title: 'Remember this',
152
- contents: [
153
- {
154
- type: 'paragraph',
155
- text: 'Hello!'
156
- }
157
- ]
158
- }
159
- ],
160
- [
161
- {
162
- title: 'Or this',
163
- contents: [
164
- {
165
- type: 'paragraph',
166
- text: 'Hello!'
167
- }
168
- ]
169
- }
170
- ]
171
- ]
172
- with_links:
173
- description: |
174
- Links can have the following attributes:
175
-
176
- - style, an attribute on the parent list that controls its appearance, either required (bold), optional (not bold) or choice (not bold, with bullets on the list). The default is optional.
177
- - context, an optional text field to show some extra information after the link, usually a monetary value
178
- - active, whether to make the link highlighted (to indicate the current page)
179
- - highlight_group, a general option to highlight a specific group of steps. Usually the active link would be in the active group, but in some circumstances there might be an active group but no highlighted link.
180
- data:
181
- highlight_group: 2
182
- show_step: 2
183
- groups: [
184
- [
185
- {
186
- title: 'Links and paragraphs',
187
- contents: [
188
- {
189
- type: 'paragraph',
190
- text: 'These links represent tasks that are required.'
191
- },
192
- {
193
- type: 'paragraph',
194
- text: 'Spacing between a paragraph and a list of links should be smaller than the spacing between two paragraphs, in order to visually connect the two.'
195
- },
196
- {
197
- type: 'list',
198
- style: 'required',
199
- contents: [
200
- {
201
- href: '/component-guide/task_list/with_links/preview',
202
- text: 'Obtain a driving licence prior to driving a car',
203
- active: true
204
- },
205
- {
206
- href: '/component-guide/task_list/with_links/preview',
207
- text: 'Acquire food before attempting to cook',
208
- context: '1p to &pound;20',
209
- active: true
210
- },
211
- {
212
- href: '/component-guide/task_list/with_links/preview',
213
- text: 'Maintain contact with the ground at all times',
214
- active: true
215
- }
216
- ]
217
- },
218
- {
219
- type: 'paragraph',
220
- text: 'These links represent tasks that are optional.'
221
- },
222
- {
223
- type: 'list',
224
- contents: [
225
- {
226
- href: '/component-guide/task_list/with_links/preview',
227
- text: 'Learn to play the saxophone',
228
- active: true
229
- },
230
- {
231
- href: '/component-guide/task_list/with_links/preview',
232
- text: 'Develop a new method of extracting juice from oranges',
233
- context: '&pound;0 to &pound;300',
234
- active: true
235
- },
236
- {
237
- href: '/component-guide/task_list/with_links/preview',
238
- text: 'Buy a race car',
239
- active: true
240
- }
241
- ]
242
- },
243
- {
244
- type: 'paragraph',
245
- text: 'These links represent a choice:'
246
- },
247
- {
248
- type: 'list',
249
- style: 'choice',
250
- contents: [
251
- {
252
- href: '/component-guide/task_list/',
253
- text: 'Leave school at sixteen',
254
- active: true
255
- },
256
- {
257
- href: '/component-guide/task_list/',
258
- text: 'Continue into higher education',
259
- context: '&pound;9,500',
260
- active: true
261
- }
262
- ]
263
- }
264
- ]
265
- }
266
- ],
267
- [
268
- {
269
- title: 'Active group and links',
270
- contents: [
271
- {
272
- type: 'list',
273
- style: 'required',
274
- contents: [
275
- {
276
- href: '/component-guide/task_list/',
277
- text: 'Check the reasons'
278
- },
279
- {
280
- href: '/component-guide/task_list/with_links/preview',
281
- text: 'Make the decisions based on available data and the reasonable assumptions that are possible at the time',
282
- context: '1p to &pound;20',
283
- active: true
284
- },
285
- {
286
- href: '/component-guide/task_list/with_links/preview',
287
- text: 'Do the things',
288
- active: true
289
- }
290
- ]
291
- },
292
- ]
293
- }
294
- ]
295
- ]
296
- with_headings:
297
- description: Headings can be included to break up complex content within steps. Headings are intended to be used to highlight 'Get help completing this step' information, but can be used in other contexts. The heading level is automatically determined based on the heading level of the step titles.
298
- data:
299
- show_step: 1
300
- heading_level: 3
301
- groups: [
302
- [
303
- {
304
- title: "Do something complicated",
305
- contents: [
306
- {
307
- type: 'paragraph',
308
- text: 'This is an example of a step containing a heading. A section has been used with the heading to demonstrate the intended appearance of a Get Help section.'
309
- },
310
- {
311
- type: 'substep',
312
- optional: true
313
- },
314
- {
315
- type: 'heading',
316
- text: 'Get help completing this step'
317
- },
318
- {
319
- type: 'list',
320
- contents: [
321
- {
322
- href: '#',
323
- text: 'Apply online'
324
- },
325
- {
326
- href: '#',
327
- text: 'Talk to one of our advisers'
328
- },
329
- {
330
- href: '#',
331
- text: 'Search our website'
332
- }
333
- ]
334
- }
335
- ]
336
- }
337
- ]
338
- ]
339
- or_then:
340
- description: Some of the more complex things in a task list require an option for laying out links in a clear structure. If a link in a list is not given a href, only the text is displayed, allowing for structures like the one shown below.
341
- data:
342
- show_step: 1
343
- groups: [
344
- [
345
- {
346
- title: "Get a court to decide your child arrangements",
347
- contents: [
348
- {
349
- type: 'paragraph',
350
- text: "You can only apply for a court to make a decision if you've tried mediation or your family are at risk, for example domestic abuse."
351
- },
352
- {
353
- type: 'list',
354
- style: 'required',
355
- contents: [
356
- {
357
- href: 'http://solicitors.lawsociety.org.uk/',
358
- text: 'Hire a lawyer to represent you',
359
- context: '&pound;110 to &pound;410 per hour'
360
- },
361
- {
362
- text: 'or',
363
- },
364
- {
365
- href: 'http://localhost:3000/represent-yourself-in-court',
366
- text: 'Represent yourself in court'
367
- }
368
- ]
369
- },
370
- {
371
- type: 'paragraph',
372
- text: 'then'
373
- },
374
- {
375
- type: 'list',
376
- style: 'required',
377
- contents: [
378
- {
379
- href: '/looking-after-children-divorce/apply-for-court-order',
380
- text: 'Apply for a court order',
381
- context: '&pound;215'
382
- },
383
- {
384
- href: 'https://courttribunalfinder.service.gov.uk/search/',
385
- text: 'Find the right court to send your application'
386
- },
387
- {
388
- href: '/get-help-with-court-fees',
389
- text: 'Get help with court fees'
390
- }
391
- ]
392
- },
393
- {
394
- type: 'paragraph',
395
- text: "The court will send you a date for your first hearing 4 to 6 weeks after your application. You'll be told when and where your hearing will take place."
396
- }
397
- ]
398
- }
399
- ]
400
- ]
401
- solve_the_double_dot_problem:
402
- description: |
403
- If a page is in a task list more than once and a user is viewing that URL, both links to it will be highlighted as the site has no way to know which entry in the task list the user is currently viewing (highlighted links should only occur when the task list is in the sidebar).
404
-
405
- JavaScript is included in the component to solve this. It uses sessionStorage to capture the data-position attribute of non-external links in the task list when clicked, and then uses this value to decide which link to highlight when the new page loads. This session storage data is immediately deleted after it is read on page load, mainly to prevent problems with highlighting if the user were to move between different task lists.
406
-
407
- If a user has not clicked a link (i.e. has visited the page without first clicking on a task list) the first active link in the first active group will be highlighted. If there is no active group, the first active link will be highlighted (but there should always be an active group).
408
-
409
- The current page in the task list is an anchor link to the top of the page. If there are more than one of these and the user clicks one that is not currently highlighted, that one will be highlighted.
410
-
411
- The example below will show all links highlighted if JS is disabled, in the real world no more than two or three links are likely to be highlighted at once.
412
- data:
413
- highlight_group: 2
414
- show_step: 2
415
- groups: [
416
- [
417
- {
418
- title: "Not the active step",
419
- contents: [
420
- {
421
- type: 'list',
422
- style: 'required',
423
- contents: [
424
- {
425
- href: 'http://google.com',
426
- text: 'External link not set to active'
427
- },
428
- {
429
- href: '/component-guide/task_list/with_links/preview',
430
- text: 'Internal link set to active',
431
- active: true
432
- },
433
- {
434
- href: '/component-guide/task_list/with_links/preview',
435
- text: 'Internal link set to active',
436
- active: true
437
- },
438
- {
439
- href: 'http://google.com',
440
- text: 'External link not set to active'
441
- }
442
- ]
443
- }
444
- ]
445
- }
446
- ],
447
- [
448
- {
449
- title: "The active step",
450
- contents: [
451
- {
452
- type: 'list',
453
- style: 'required',
454
- contents: [
455
- {
456
- href: '/component-guide/task_list/with_links/preview',
457
- text: 'Internal link set to active - in the active group, should be set by default until another link is clicked',
458
- active: true
459
- },
460
- {
461
- href: '/component-guide/task_list/with_links/preview',
462
- text: 'Internal link set to active',
463
- active: true
464
- },
465
- {
466
- href: 'http://google.com',
467
- text: 'External link not set to active'
468
- }
469
- ]
470
- }
471
- ]
472
- }
473
- ]
474
- ]
475
- with_optional_steps:
476
- description: |
477
- Steps can be optional. This is controlled by two parameters for maximum flexibility, 'optional' (which causes the step to have a dotted line down the side) and 'logic', which defaults to showing the word 'and' alongside the step title, but also accepts 'or'.
478
-
479
- If a step is optional this should be conveyed by the text within that step.
480
- data:
481
- groups: [
482
- [
483
- {
484
- title: "Drive to work",
485
- contents: [
486
- {
487
- type: paragraph,
488
- text: 'If you do not have a car, you will need to choose an alternative.'
489
- }
490
- ]
491
- },
492
- {
493
- title: "Walk to work",
494
- optional: true,
495
- logic: 'or',
496
- contents: [
497
- {
498
- type: 'paragraph',
499
- text: 'Walking is healthy but may not be practical where large distances are concerned.'
500
- }
501
- ]
502
- },
503
- {
504
- title: "Get public transport to work",
505
- optional: true,
506
- logic: 'or',
507
- contents: [
508
- {
509
- type: 'paragraph',
510
- text: 'Public transport includes buses, trains and boats.'
511
- }
512
- ]
513
- }
514
- ],
515
- [
516
- {
517
- title: "Do work",
518
- contents: [
519
- {
520
- type: 'paragraph',
521
- text: 'Once you have reached your destination you should be able to start work.'
522
- }
523
- ]
524
- },
525
- {
526
- title: "Get paid",
527
- contents: [
528
- {
529
- type: 'paragraph',
530
- text: 'Your employer should pay you for hours worked.'
531
- }
532
- ]
533
- }
534
- ]
535
- ]
536
- with_sub_steps:
537
- description: Steps can also contain sub steps, which act either as a way to break up content or to indicate that some tasks are optional. Whenever a step or sub step is optional this should be made clear in the written content. Optional steps are styled differently but this should support the meaning, not convey it.
538
- data:
539
- highlight_group: 2
540
- show_step: 2
541
- groups: [
542
- [
543
- {
544
- title: "A required step",
545
- contents: [
546
- {
547
- type: 'paragraph',
548
- text: 'This step ends with an optional sub step.'
549
- },
550
- {
551
- type: 'substep',
552
- optional: true
553
- },
554
- {
555
- type: 'paragraph',
556
- text: 'This paragraph is inside the sub step.'
557
- },
558
- {
559
- type: 'list',
560
- contents: [
561
- {
562
- href: '/test6',
563
- text: 'This link is also inside the sub step'
564
- }
565
- ]
566
- }
567
- ]
568
- }
569
- ],
570
- [
571
- {
572
- title: "An optional step",
573
- optional: true,
574
- contents: [
575
- {
576
- type: 'paragraph',
577
- text: 'This optional step contains multiple sub steps.'
578
- },
579
- {
580
- type: 'substep',
581
- optional: false
582
- },
583
- {
584
- type: 'paragraph',
585
- text: 'This paragraph is inside a required sub step.'
586
- },
587
- {
588
- type: 'substep',
589
- optional: true
590
- },
591
- {
592
- type: 'paragraph',
593
- text: 'This paragraph is inside an optional sub step.'
594
- },
595
- {
596
- type: 'list',
597
- contents: [
598
- {
599
- href: '/test7',
600
- text: 'This link is inside an optional sub step as well',
601
- active: true
602
- }
603
- ]
604
- },
605
- {
606
- type: 'substep',
607
- optional: false
608
- },
609
- {
610
- type: 'paragraph',
611
- text: 'This paragraph is inside a required sub step.'
612
- }
613
- ]
614
- }
615
- ],
616
- [
617
- {
618
- title: "Another required step",
619
- contents: [
620
- {
621
- type: 'paragraph',
622
- text: 'Um. Hello.'
623
- }
624
- ]
625
- }
626
- ]
627
- ]
628
- get_help_links:
629
- description: |
630
- Where task lists are long, content can be substituted with a link back to the main task list page. This link will open the main task list page with that step shown. The link text defaults to "Get help completing this step" but can be overridden.
631
-
632
- Get help links will only appear if the task_list_url global parameter is set and the step itself has the optional show_help_link parameter set to true.
633
-
634
- Note that this option does not remove any content - it is left to developers to simply pass less content to the component in this situation.
635
- data:
636
- task_list_url: "/learn-to-do-something"
637
- task_list_url_link_text: "Get more information"
638
- show_step: 1
639
- groups: [
640
- [
641
- {
642
- title: "A link back to the main task list",
643
- show_help_link: true,
644
- contents: [
645
- {
646
- type: 'list',
647
- contents: [
648
- {
649
- href: '/test7',
650
- text: 'This is a link'
651
- },
652
- {
653
- href: '/test7',
654
- text: 'This is another link'
655
- }
656
- ]
657
- }
658
- ]
659
- }
660
- ],
661
- [
662
- {
663
- title: "No help link here",
664
- contents: [
665
- {
666
- type: 'list',
667
- contents: [
668
- {
669
- href: '/test7',
670
- text: 'This is yet another link'
671
- },
672
- {
673
- href: '/test7',
674
- text: 'This is a further link'
675
- },
676
- ]
677
- }
678
- ]
679
- }
680
- ]
681
- ]
682
- test_all_the_things:
683
- description: This component is very complicated so here is an example containing as many of the options available as possible.
684
- data:
685
- task_list_url: "/learn-to-setup-standup"
686
- highlight_group: 2
687
- groups: [
688
- [
689
- {
690
- title: 'Get the TV ready',
691
- contents: [
692
- {
693
- type: 'paragraph',
694
- text: 'Configure the television so it is ready for the standup. You will also need a laptop.'
695
- },
696
- {
697
- type: 'list',
698
- style: 'required',
699
- contents: [
700
- {
701
- href: 'https://en.wikipedia.org/wiki/HDMI',
702
- text: 'Remove the Chromebit from HDMI 1 on the TV'
703
- }
704
- ]
705
- }
706
- ]
707
- },
708
- {
709
- title: 'Plug everything in',
710
- contents: [
711
- {
712
- type: 'paragraph',
713
- text: 'Connect the relevant cables between the various devices.'
714
- },
715
- {
716
- type: 'list',
717
- style: 'required',
718
- contents: [
719
- {
720
- href: 'https://www.google.co.uk/',
721
- text: 'Run the HDMI - MINI DVI cable from the TV to the facilitators laptop'
722
- },
723
- {
724
- href: 'https://www.jabra.co.uk/',
725
- text: 'Plug the Jabra into the facilitators laptop'
726
- }
727
- ]
728
- }
729
- ]
730
- }
731
- ],
732
- [
733
- {
734
- title: 'Configure the catchbox',
735
- contents: [
736
- {
737
- type: 'paragraph',
738
- text: 'These steps are required.'
739
- },
740
- {
741
- type: 'list',
742
- style: 'required',
743
- contents: [
744
- {
745
- href: 'http://www.google.com',
746
- text: 'Ensure the catchbox transmitter is plugged in at the mains wall'
747
- },
748
- {
749
- href: 'http://www.google.com',
750
- text: 'Turn on the transmitter and wait for the switch to blink green'
751
- },
752
- {
753
- href: 'http://www.google.com',
754
- text: 'Plug the transmitter USB cable into the facilitators laptop',
755
- active: true
756
- },
757
- {
758
- href: 'http://www.google.com',
759
- text: 'Twist and pull the black piece of foam out of the catchbox'
760
- },
761
- {
762
- href: 'http://www.google.com',
763
- text: 'Turn on the catchbox and wait for the LED to turn green'
764
- },
765
- {
766
- href: 'http://www.google.com',
767
- text: 'Wait for the transmitter light to turn solid green'
768
- }
769
- ]
770
- },
771
- {
772
- type: 'substep',
773
- optional: true
774
- },
775
- {
776
- type: 'heading',
777
- text: 'Optional steps'
778
- },
779
- {
780
- type: 'paragraph',
781
- text: 'These steps are not required.'
782
- },
783
- {
784
- type: 'list',
785
- style: 'choice',
786
- contents: [
787
- {
788
- href: 'https://www.google.co.uk/',
789
- text: "Get annoyed when it doesn't work"
790
- },
791
- {
792
- href: 'http://www.google.com',
793
- text: 'Try to find someone else who knows how to do it',
794
- context: '1 to 10 minutes'
795
- }
796
- ]
797
- }
798
- ]
799
- }
800
- ],
801
- [
802
- {
803
- title: 'Join and configure the standup',
804
- show_help_link: true,
805
- contents: [
806
- {
807
- type: 'paragraph',
808
- text: 'Join the hangout and present to those on it.'
809
- },
810
- {
811
- type: 'list',
812
- style: 'required',
813
- contents: [
814
- {
815
- href: 'http://www.google.com',
816
- text: 'Connect to standup hangout via the calendar invite'
817
- },
818
- {
819
- text: 'or'
820
- },
821
- {
822
- href: 'http://www.google.com',
823
- text: 'Connect to standup hangout via the link in the team slack'
824
- }
825
- ]
826
- },
827
- {
828
- type: 'paragraph',
829
- text: 'then'
830
- },
831
- {
832
- type: 'list',
833
- style: 'required',
834
- contents: [
835
- {
836
- href: 'http://www.google.com',
837
- text: 'Click the three dots in the bottom hand corner to open settings'
838
- },
839
- {
840
- href: 'http://www.google.com',
841
- text: 'Set speaker to "Jabra"'
842
- },
843
- {
844
- href: 'http://www.google.com',
845
- text: 'Set microphone to "C Media USB"'
846
- },
847
- {
848
- href: 'http://www.google.com',
849
- text: 'Click "present to meeting"'
850
- },
851
- ]
852
- }
853
- ]
854
- }
855
- ],
856
- [
857
- {
858
- title: 'Clear up',
859
- contents: [
860
- {
861
- type: 'paragraph',
862
- text: 'Disconnect from the hangout and disconnect any cables.'
863
- },
864
- {
865
- type: 'paragraph',
866
- text: 'Most importantly, remember to switch off the catchbox to save the battery.'
867
- }
868
- ]
869
- },
870
- {
871
- title: 'Get someone else to clear up',
872
- logic: 'or',
873
- optional: true,
874
- contents: [
875
- {
876
- type: 'paragraph',
877
- text: 'Schedule another meeting for right after the standup and force someone else to sort everything out.'
878
- }
879
- ]
880
- }
881
- ]
882
- ]
883
- small:
884
- description: Designed to fit in the sidebar of a page. Note that the small version of the task list should not become smaller on mobile, and the large version on mobile should be the same size as the small version. This example is a copy of the one above for comparison.
885
- data:
886
- small: true
887
- remember_last_step: true
888
- task_list_url: "/learn-to-setup-standup"
889
- highlight_group: 2
890
- groups: [
891
- [
892
- {
893
- title: 'Get the TV ready (small)',
894
- contents: [
895
- {
896
- type: 'paragraph',
897
- text: 'Configure the television so it is ready for the standup. You will also need a laptop.'
898
- },
899
- {
900
- type: 'list',
901
- style: 'required',
902
- contents: [
903
- {
904
- href: 'https://en.wikipedia.org/wiki/HDMI',
905
- text: 'Remove the Chromebit from HDMI 1 on the TV'
906
- }
907
- ]
908
- }
909
- ]
910
- },
911
- {
912
- title: 'Plug everything in (small)',
913
- contents: [
914
- {
915
- type: 'paragraph',
916
- text: 'Connect the relevant cables between the various devices.'
917
- },
918
- {
919
- type: 'list',
920
- style: 'required',
921
- contents: [
922
- {
923
- href: 'https://www.google.co.uk/',
924
- text: 'Run the HDMI - MINI DVI cable from the TV to the facilitators laptop'
925
- },
926
- {
927
- href: 'https://www.jabra.co.uk/',
928
- text: 'Plug the Jabra into the facilitators laptop'
929
- }
930
- ]
931
- }
932
- ]
933
- }
934
- ],
935
- [
936
- {
937
- title: 'Configure the catchbox (small)',
938
- contents: [
939
- {
940
- type: 'paragraph',
941
- text: 'These steps are required.'
942
- },
943
- {
944
- type: 'list',
945
- style: 'required',
946
- contents: [
947
- {
948
- href: 'http://www.google.com',
949
- text: 'Ensure the catchbox transmitter is plugged in at the mains wall'
950
- },
951
- {
952
- href: 'http://www.google.com',
953
- text: 'Turn on the transmitter and wait for the switch to blink green'
954
- },
955
- {
956
- href: 'http://www.google.com',
957
- text: 'Plug the transmitter USB cable into the facilitators laptop',
958
- active: true
959
- },
960
- {
961
- href: 'http://www.google.com',
962
- text: 'Twist and pull the black piece of foam out of the catchbox'
963
- },
964
- {
965
- href: 'http://www.google.com',
966
- text: 'Turn on the catchbox and wait for the LED to turn green'
967
- },
968
- {
969
- href: 'http://www.google.com',
970
- text: 'Wait for the transmitter light to turn solid green'
971
- }
972
- ]
973
- },
974
- {
975
- type: 'substep',
976
- optional: true
977
- },
978
- {
979
- type: 'heading',
980
- text: 'Optional steps'
981
- },
982
- {
983
- type: 'paragraph',
984
- text: 'These steps are not required.'
985
- },
986
- {
987
- type: 'list',
988
- style: 'choice',
989
- contents: [
990
- {
991
- href: 'https://www.google.co.uk/',
992
- text: "Get annoyed when it doesn't work"
993
- },
994
- {
995
- href: 'http://www.google.com',
996
- text: 'Try to find someone else who knows how to do it',
997
- context: '1 to 10 minutes'
998
- }
999
- ]
1000
- }
1001
- ]
1002
- }
1003
- ],
1004
- [
1005
- {
1006
- title: 'Join and configure the standup (small)',
1007
- show_help_link: true,
1008
- contents: [
1009
- {
1010
- type: 'paragraph',
1011
- text: 'Join the hangout and present to those on it.'
1012
- },
1013
- {
1014
- type: 'list',
1015
- style: 'required',
1016
- contents: [
1017
- {
1018
- href: 'http://www.google.com',
1019
- text: 'Connect to standup hangout via the calendar invite'
1020
- },
1021
- {
1022
- text: 'or'
1023
- },
1024
- {
1025
- href: 'http://www.google.com',
1026
- text: 'Connect to standup hangout via the link in the team slack'
1027
- }
1028
- ]
1029
- },
1030
- {
1031
- type: 'paragraph',
1032
- text: 'then'
1033
- },
1034
- {
1035
- type: 'list',
1036
- style: 'required',
1037
- contents: [
1038
- {
1039
- href: 'http://www.google.com',
1040
- text: 'Click the three dots in the bottom hand corner to open settings'
1041
- },
1042
- {
1043
- href: 'http://www.google.com',
1044
- text: 'Set speaker to "Jabra"'
1045
- },
1046
- {
1047
- href: 'http://www.google.com',
1048
- text: 'Set microphone to "C Media USB"'
1049
- },
1050
- {
1051
- href: 'http://www.google.com',
1052
- text: 'Click "present to meeting"'
1053
- },
1054
- ]
1055
- }
1056
- ]
1057
- }
1058
- ],
1059
- [
1060
- {
1061
- title: 'Clear up (small)',
1062
- contents: [
1063
- {
1064
- type: 'paragraph',
1065
- text: 'Disconnect from the hangout and disconnect any cables.'
1066
- },
1067
- {
1068
- type: 'paragraph',
1069
- text: 'Most importantly, remember to switch off the catchbox to save the battery.'
1070
- }
1071
- ]
1072
- },
1073
- {
1074
- title: 'Get someone else to clear up (small)',
1075
- logic: 'or',
1076
- optional: true,
1077
- contents: [
1078
- {
1079
- type: 'paragraph',
1080
- text: 'Schedule another meeting for right after the standup and force someone else to sort everything out.'
1081
- }
1082
- ]
1083
- }
1084
- ]
1085
- ]