govuk_publishing_components 5.6.0 → 5.7.0

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: a741268b6b87bdca3271b0988eef9a43ec7e9b01ad03b59a0bdcdc1611c72278
4
- data.tar.gz: e5bd85deb2d496c428100b9e3711a78982e42b39d7aff181b5802e6b1e2a4cf7
3
+ metadata.gz: ce80409c0f807cc7819ef704621d4ea7fba120eb3c236cfdb0f08416989273fb
4
+ data.tar.gz: 3f80608cb59362aac2d3be655530e0da2c985847f93c4a50ef5413d5d4b5c7af
5
5
  SHA512:
6
- metadata.gz: 17e7019b89f86cec1c4e3a80f89495e34ba94ae01350308d23f4795138d673f69112edc8b65668b2337696dcdf62d4cdf2499d0a1b95bc5e315e32a3c0c76812
7
- data.tar.gz: cc2f4a5a5124f7e8ba80db9b995f0c14c673b3fcdb5222c08565087ccfafc5a23ed2a15203b5abf5d3cab97e28cd449c799475a1cfb56d2310db545fe0ccb367
6
+ metadata.gz: 5e9a0fd1f8c25254e8d945c05cda605ebbdbad784916ca5544e9f77e9eb6c0f86f8e94f6f507dd366840d1935374c6cfbe6f8d92498eaa25dc4a43c2df6d53d1
7
+ data.tar.gz: 1f81579d4f44e2e62be07291827ca3ace6ab1ca1002a2f54467a961a3ecf1721a45fd27b7b54daeaf2da6fb42e1e588f14c3c551d692e14b450d0054b6e4da6c
@@ -27,7 +27,7 @@
27
27
  var rememberShownStep = false;
28
28
  var stepNavSize;
29
29
  var sessionStoreLink = 'govuk-step-nav-active-link';
30
- var activeLinkClass = 'gem-c-step-nav__link--active';
30
+ var activeLinkClass = 'gem-c-step-nav__list-item--active';
31
31
  var activeLinkHref = '#content';
32
32
 
33
33
  this.start = function ($element) {
@@ -45,7 +45,7 @@
45
45
  var $steps = $element.find('.js-step');
46
46
  var $stepHeaders = $element.find('.js-toggle-panel');
47
47
  var totalSteps = $element.find('.js-panel').length;
48
- var totalLinks = $element.find('.gem-c-step-nav__link-item').length;
48
+ var totalLinks = $element.find('.gem-c-step-nav__link').length;
49
49
 
50
50
  var $showOrHideAllButton;
51
51
 
@@ -170,7 +170,6 @@
170
170
 
171
171
  function bindToggleForSteps(stepNavTracker) {
172
172
  $element.find('.js-toggle-panel').click(function (event) {
173
- preventLinkFollowingForCurrentTab(event);
174
173
  var $step = $(this).closest('.js-step');
175
174
 
176
175
  var stepView = new StepView($step);
@@ -250,16 +249,6 @@
250
249
  });
251
250
  }
252
251
 
253
- function preventLinkFollowingForCurrentTab(event) {
254
- // If the user is holding the ⌘ or Ctrl key, they're trying
255
- // to open the link in a new window, so let the click happen
256
- if (event.metaKey || event.ctrlKey) {
257
- return;
258
- }
259
-
260
- event.preventDefault();
261
- }
262
-
263
252
  function bindToggleShowHideAllButton(stepNavTracker) {
264
253
  $showOrHideAllButton = $element.find('.js-step-controls-button');
265
254
  $showOrHideAllButton.on('click', function () {
@@ -437,7 +426,7 @@
437
426
 
438
427
  function trackClick() {
439
428
  var tracking_options = {label: $(event.target).attr('href') + " : " + stepNavSize};
440
- var dimension28 = $(event.target).closest('.gem-c-step-nav__links').attr('data-length');
429
+ var dimension28 = $(event.target).closest('.gem-c-step-nav__list').attr('data-length');
441
430
 
442
431
  if (dimension28) {
443
432
  tracking_options['dimension28'] = dimension28;
@@ -3,7 +3,8 @@
3
3
  background-color: $govuk-blue;
4
4
  color: $white;
5
5
  margin-bottom: $gutter;
6
- padding: $gutter-half;
6
+ padding: $gutter-half $gutter $gutter;
7
+ box-sizing: border-box;
7
8
  }
8
9
 
9
10
  .gem-c-inverse-header a {
@@ -13,4 +14,5 @@
13
14
  .gem-c-inverse-header--full-width {
14
15
  padding-left: 0;
15
16
  padding-right: 0;
17
+ padding-bottom: $gutter-half;
16
18
  }
@@ -29,11 +29,3 @@
29
29
  margin-top: 5px;
30
30
  }
31
31
  }
32
-
33
- .gem-c-step-nav-related__link {
34
- text-decoration: none;
35
-
36
- &:hover {
37
- text-decoration: underline;
38
- }
39
- }
@@ -286,7 +286,7 @@ $top-border: solid 2px $grey-3;
286
286
  margin: 0;
287
287
  font-size: inherit;
288
288
 
289
- + .gem-c-step-nav__links {
289
+ + .gem-c-step-nav__list {
290
290
  margin-top: -5px;
291
291
 
292
292
  .gem-c-step-nav--large & {
@@ -307,7 +307,7 @@ $top-border: solid 2px $grey-3;
307
307
  font-weight: bold;
308
308
  }
309
309
 
310
- .gem-c-step-nav__links {
310
+ .gem-c-step-nav__list {
311
311
  padding: 0;
312
312
  padding-bottom: 10px;
313
313
 
@@ -318,30 +318,30 @@ $top-border: solid 2px $grey-3;
318
318
  }
319
319
  }
320
320
 
321
- .gem-c-step-nav__links--choice {
321
+ .gem-c-step-nav__list--choice {
322
322
  $links-margin: 20px;
323
323
 
324
324
  margin-left: $links-margin;
325
325
  list-style: disc;
326
326
 
327
- .gem-c-step-nav__link--active:before {
327
+ .gem-c-step-nav__list-item--active:before {
328
328
  left: -($gutter + $gutter-half) - $links-margin;
329
329
  }
330
330
 
331
331
  .gem-c-step-nav--large & {
332
332
  @include media(tablet) {
333
- .gem-c-step-nav__link--active:before {
333
+ .gem-c-step-nav__list-item--active:before {
334
334
  left: -($gutter * 2) - $links-margin;
335
335
  }
336
336
  }
337
337
  }
338
338
  }
339
339
 
340
- .gem-c-step-nav__link {
340
+ .gem-c-step-nav__list-item {
341
341
  margin-bottom: 10px;
342
342
  }
343
343
 
344
- .gem-c-step-nav__link--active {
344
+ .gem-c-step-nav__list-item--active {
345
345
  position: relative;
346
346
 
347
347
  &:before {
@@ -369,7 +369,7 @@ $top-border: solid 2px $grey-3;
369
369
  }
370
370
  }
371
371
 
372
- .gem-c-step-nav__link-item {
372
+ .gem-c-step-nav__link {
373
373
  color: $black;
374
374
  text-decoration: none;
375
375
 
@@ -74,24 +74,12 @@
74
74
  %>
75
75
  <% step[:contents].each do |element| %>
76
76
  <%= step_nav_helper.render_step_nav_element(element, options) %>
77
+
77
78
  <%
78
79
  if element[:type] == 'list'
79
80
  options[:link_index] += element[:contents].length
80
81
  end
81
82
  %>
82
-
83
- <% if element[:type] == 'substep' %>
84
- <% if in_substep %>
85
- </div>
86
- <% in_substep = false %>
87
- <% end %>
88
- <div class="gem-c-step-nav__substep <% if element[:optional] %>gem-c-step-nav__substep--optional<% end %>">
89
- <% in_substep = true %>
90
- <% end %>
91
- <% end %>
92
-
93
- <% if in_substep %>
94
- </div>
95
83
  <% end %>
96
84
 
97
85
  <% if step_nav_url && step[:show_help_link] %>
@@ -1,7 +1,6 @@
1
1
  <%
2
2
  links ||= false
3
3
  pretitle ||= t("govuk_component.step_by_step_nav_related.part_of", default: "Part of")
4
- tracking_id ||= false
5
4
  %>
6
5
  <% if links %>
7
6
  <div class="gem-c-step-nav-related" data-module="track-click">
@@ -15,7 +14,7 @@
15
14
  data-track-label="<%= links[0][:href] %>"
16
15
  data-track-dimension="<%= links[0][:text] %>"
17
16
  data-track-dimension-index="29"
18
- data-track-options='{"dimension96" : "<%= tracking_id %>" }'>
17
+ data-track-options='{"dimension96" : "<%= links[0][:tracking_id] %>" }'>
19
18
  <%= links[0][:text] %>
20
19
  </a>
21
20
  </h2>
@@ -31,7 +30,7 @@
31
30
  data-track-label="<%= link[:href] %>"
32
31
  data-track-dimension="<%= link[:text] %>"
33
32
  data-track-dimension-index="29"
34
- data-track-options='{"dimension96" : "<%= tracking_id %>" }'>
33
+ data-track-options='{"dimension96" : "<%= link[:tracking_id] %>" }'>
35
34
  <%= link[:text] %>
36
35
  </a>
37
36
  </li>
@@ -28,6 +28,17 @@ examples:
28
28
  Education, Training and Skills
29
29
  </h1>
30
30
  </div>
31
+ html_publication_header:
32
+ description: "The inverse header component is used on HTMl publications. [See example on GOV.UK here](https://www.gov.uk/government/publications/ln5-0at-jackson-homes-scopwick-ltd-environmental-permit-application-advertisement/ln5-0at-jackson-homes-scopwick-ltd-environmental-permit-application)"
33
+ data:
34
+ block: |
35
+ <div class="pub-c-title pub-c-title--inverse pub-c-title--bottom-margin">
36
+ <p class="pub-c-title__context">Notice</p>
37
+ <h1 class="pub-c-title__text">
38
+ LN5 0AT, Jackson Homes (Scopwick) Ltd: environmental permit application
39
+ </h1>
40
+ </div>
41
+ <p class="publication-header__last-changed">Published 22 April 2016</p>
31
42
  with_breadcrumbs_and_paragraph:
32
43
  data:
33
44
  block: |
@@ -72,7 +72,7 @@ examples:
72
72
  ]
73
73
  with_unique_tracking:
74
74
  description: |
75
- We need to uniquely identify each step by step navigation in Google Analytics. If this parameter is added to the component, its value is included in any tracking events, specifically in dimension96.
75
+ In order to identify the step by step navigation the component is part of, we need to track a unique ID of the navigation in Google Analytics. This ID should be the same across all pages that are linked from and are part of that navigation. Its value is included in any tracking events, specifically in dimension96. It refers to the ID of the step nav page.
76
76
 
77
77
  This includes show/hide all, show/hide step and any link clicks.
78
78
  data:
@@ -295,26 +295,28 @@ examples:
295
295
  },
296
296
  {
297
297
  type: 'substep',
298
- optional: true
299
- },
300
- {
301
- type: 'heading',
302
- text: 'Get help completing this step'
303
- },
304
- {
305
- type: 'list',
298
+ optional: true,
306
299
  contents: [
307
300
  {
308
- href: '#',
309
- text: 'Apply online'
310
- },
311
- {
312
- href: '#',
313
- text: 'Talk to one of our advisers'
301
+ type: 'heading',
302
+ text: 'Get help completing this step'
314
303
  },
315
304
  {
316
- href: '#',
317
- text: 'Search our website'
305
+ type: 'list',
306
+ contents: [
307
+ {
308
+ href: '#',
309
+ text: 'Apply online'
310
+ },
311
+ {
312
+ href: '#',
313
+ text: 'Talk to one of our advisers'
314
+ },
315
+ {
316
+ href: '#',
317
+ text: 'Search our website'
318
+ }
319
+ ]
318
320
  }
319
321
  ]
320
322
  }
@@ -523,18 +525,20 @@ examples:
523
525
  },
524
526
  {
525
527
  type: 'substep',
526
- optional: true
527
- },
528
- {
529
- type: 'paragraph',
530
- text: 'This paragraph is inside the sub step.'
531
- },
532
- {
533
- type: 'list',
528
+ optional: true,
534
529
  contents: [
535
530
  {
536
- href: '/test6',
537
- text: 'This link is also inside the sub step'
531
+ type: 'paragraph',
532
+ text: 'This paragraph is inside the sub step.'
533
+ },
534
+ {
535
+ type: 'list',
536
+ contents: [
537
+ {
538
+ href: '/test6',
539
+ text: 'This link is also inside the sub step'
540
+ }
541
+ ]
538
542
  }
539
543
  ]
540
544
  }
@@ -550,38 +554,44 @@ examples:
550
554
  },
551
555
  {
552
556
  type: 'substep',
553
- optional: false
554
- },
555
- {
556
- type: 'paragraph',
557
- text: 'This paragraph is inside a required sub step.'
557
+ optional: false,
558
+ contents: [
559
+ {
560
+ type: 'paragraph',
561
+ text: 'This paragraph is inside a required sub step.'
562
+ }
563
+ ]
558
564
  },
559
565
  {
560
566
  type: 'substep',
561
- optional: true
562
- },
563
- {
564
- type: 'paragraph',
565
- text: 'This paragraph is inside an optional sub step.'
566
- },
567
- {
568
- type: 'list',
567
+ optional: true,
569
568
  contents: [
570
569
  {
571
- href: '/test7',
572
- text: 'This link is inside an optional sub step as well',
573
- active: true
574
- }
570
+ type: 'paragraph',
571
+ text: 'This paragraph is inside an optional sub step.'
572
+ },
573
+ {
574
+ type: 'list',
575
+ contents: [
576
+ {
577
+ href: '/test7',
578
+ text: 'This link is inside an optional sub step as well',
579
+ active: true
580
+ }
581
+ ]
582
+ },
575
583
  ]
576
584
  },
577
585
  {
578
586
  type: 'substep',
579
- optional: false
587
+ optional: false,
588
+ contents: [
589
+ {
590
+ type: 'paragraph',
591
+ text: 'This paragraph is inside a required sub step.'
592
+ }
593
+ ]
580
594
  },
581
- {
582
- type: 'paragraph',
583
- text: 'This paragraph is inside a required sub step.'
584
- }
585
595
  ]
586
596
  },
587
597
  {
@@ -730,28 +740,30 @@ examples:
730
740
  },
731
741
  {
732
742
  type: 'substep',
733
- optional: true
734
- },
735
- {
736
- type: 'heading',
737
- text: 'Optional steps'
738
- },
739
- {
740
- type: 'paragraph',
741
- text: 'These steps are not required.'
742
- },
743
- {
744
- type: 'list',
745
- style: 'choice',
743
+ optional: true,
746
744
  contents: [
747
745
  {
748
- href: 'https://www.google.co.uk/',
749
- text: "Get annoyed when it doesn't work"
746
+ type: 'heading',
747
+ text: 'Optional steps'
750
748
  },
751
749
  {
752
- href: 'http://www.google.com',
753
- text: 'Try to find someone else who knows how to do it',
754
- context: '1 to 10 minutes'
750
+ type: 'paragraph',
751
+ text: 'These steps are not required.'
752
+ },
753
+ {
754
+ type: 'list',
755
+ style: 'choice',
756
+ contents: [
757
+ {
758
+ href: 'https://www.google.co.uk/',
759
+ text: "Get annoyed when it doesn't work"
760
+ },
761
+ {
762
+ href: 'http://www.google.com',
763
+ text: 'Try to find someone else who knows how to do it',
764
+ context: '1 to 10 minutes'
765
+ }
766
+ ]
755
767
  }
756
768
  ]
757
769
  }
@@ -921,28 +933,30 @@ examples:
921
933
  },
922
934
  {
923
935
  type: 'substep',
924
- optional: true
925
- },
926
- {
927
- type: 'heading',
928
- text: 'Optional steps'
929
- },
930
- {
931
- type: 'paragraph',
932
- text: 'These steps are not required.'
933
- },
934
- {
935
- type: 'list',
936
- style: 'choice',
936
+ optional: true,
937
937
  contents: [
938
938
  {
939
- href: 'https://www.google.co.uk/',
940
- text: "Get annoyed when it doesn't work"
939
+ type: 'heading',
940
+ text: 'Optional steps'
941
941
  },
942
942
  {
943
- href: 'http://www.google.com',
944
- text: 'Try to find someone else who knows how to do it',
945
- context: '1 to 10 minutes'
943
+ type: 'paragraph',
944
+ text: 'These steps are not required.'
945
+ },
946
+ {
947
+ type: 'list',
948
+ style: 'choice',
949
+ contents: [
950
+ {
951
+ href: 'https://www.google.co.uk/',
952
+ text: "Get annoyed when it doesn't work"
953
+ },
954
+ {
955
+ href: 'http://www.google.com',
956
+ text: 'Try to find someone else who knows how to do it',
957
+ context: '1 to 10 minutes'
958
+ }
959
+ ]
946
960
  }
947
961
  ]
948
962
  }
@@ -17,7 +17,7 @@ examples:
17
17
  title: 'Having children: step by step'
18
18
  path: /childcare-parenting/pregnancy-and-birth
19
19
  with_unique_tracking:
20
- description: We need to uniquely identify each step by step navigation in Google Analytics. If this parameter is added to the component, its value is included in any tracking events, specifically in dimension96.
20
+ description: In order to identify the step by step navigation the component is part of, we need to track a unique ID of the navigation in Google Analytics. This ID should be the same across all pages that are linked from and are part of that navigation. Its value is included in any tracking events, specifically in dimension96. It refers to the ID of the step nav that the component links to.
21
21
  data:
22
22
  title: 'With a tracking id'
23
23
  path: '#'
@@ -53,12 +53,12 @@ examples:
53
53
  }
54
54
  ]
55
55
  with_unique_tracking:
56
- description: We need to uniquely identify each step by step navigation in Google Analytics. If this parameter is added to the component, its value is included in any tracking events, specifically in dimension96.
56
+ description: In order to identify the step by step navigation the component is part of, we need to track a unique ID of the navigation in Google Analytics. This ID should be the same across all pages that are linked from and are part of that navigation. Its value is included in any tracking events, specifically in dimension96. It refers to the ID of the step nav that the component links to. Where there are multiple links, they will have different tracking IDs.
57
57
  data:
58
- tracking_id: 'this-is-the-tracking-id'
59
58
  links: [
60
59
  {
61
60
  href: '#',
62
- text: 'With a tracking id'
61
+ text: 'With a tracking id',
62
+ tracking_id: 'this-is-the-tracking-id'
63
63
  }
64
64
  ]
@@ -13,6 +13,10 @@ module GovukPublishingComponents
13
13
  content_item[:base_path]
14
14
  end
15
15
 
16
+ def content_id
17
+ content_item[:content_id]
18
+ end
19
+
16
20
  def content
17
21
  content_item.dig(:details, :step_by_step_nav)
18
22
  end
@@ -28,7 +28,8 @@ module GovukPublishingComponents
28
28
  step_navs.map do |step_nav|
29
29
  {
30
30
  href: step_nav.base_path,
31
- text: step_nav.title
31
+ text: step_nav.title,
32
+ tracking_id: step_nav.content_id
32
33
  }
33
34
  end
34
35
  end
@@ -37,7 +38,7 @@ module GovukPublishingComponents
37
38
  if show_sidebar?
38
39
  @sidebar ||= first_step_nav.content.tap do |sb|
39
40
  configure_for_sidebar(sb)
40
- sb.merge!(small: true, heading_level: 3)
41
+ sb.merge!(small: true, heading_level: 3, tracking_id: first_step_nav.content_id)
41
42
  end
42
43
  end
43
44
  end
@@ -46,7 +47,8 @@ module GovukPublishingComponents
46
47
  if show_header?
47
48
  {
48
49
  title: first_step_nav.title,
49
- path: first_step_nav.base_path
50
+ path: first_step_nav.base_path,
51
+ tracking_id: first_step_nav.content_id
50
52
  }
51
53
  else
52
54
  {}
@@ -17,6 +17,8 @@ module GovukPublishingComponents
17
17
  heading(element[:text])
18
18
  when "list"
19
19
  list(element)
20
+ when "substep"
21
+ substep(element)
20
22
  end
21
23
  end
22
24
 
@@ -46,7 +48,7 @@ module GovukPublishingComponents
46
48
  def list(element)
47
49
  content_tag(
48
50
  get_list_element(element[:style]),
49
- class: "gem-c-step-nav__links #{get_list_style(element[:style])}",
51
+ class: "gem-c-step-nav__list #{get_list_style(element[:style])}",
50
52
  data: {
51
53
  length: element[:contents].length
52
54
  }
@@ -55,7 +57,7 @@ module GovukPublishingComponents
55
57
  concat(
56
58
  content_tag(
57
59
  :li,
58
- class: "gem-c-step-nav__link js-list-item #{link_active(contents[:active])}"
60
+ class: "gem-c-step-nav__list-item js-list-item #{link_active(contents[:active])}"
59
61
  ) do
60
62
  create_list_item_content(contents)
61
63
  end
@@ -64,6 +66,20 @@ module GovukPublishingComponents
64
66
  end
65
67
  end
66
68
 
69
+ def substep(element)
70
+ optional = "gem-c-step-nav__substep--optional" if element[:optional] == true
71
+ content_tag(
72
+ :div,
73
+ class: "gem-c-step-nav__substep #{optional}"
74
+ ) do
75
+ element[:contents].collect { |contents|
76
+ concat(
77
+ render_step_nav_element(contents, @options)
78
+ )
79
+ }
80
+ end
81
+ end
82
+
67
83
  def create_list_item_content(link)
68
84
  if link[:href]
69
85
  @link_index += 1
@@ -76,7 +92,7 @@ module GovukPublishingComponents
76
92
  data: {
77
93
  position: "#{@options[:step_index] + 1}.#{@link_index}"
78
94
  },
79
- class: "gem-c-step-nav__link-item js-link"
95
+ class: "gem-c-step-nav__link js-link"
80
96
  ) do
81
97
  text
82
98
  end
@@ -90,7 +106,7 @@ module GovukPublishingComponents
90
106
  end
91
107
 
92
108
  def get_list_style(style)
93
- "gem-c-step-nav__links--choice" if style == "choice"
109
+ "gem-c-step-nav__list--choice" if style == "choice"
94
110
  end
95
111
 
96
112
  def get_list_element(style)
@@ -106,7 +122,7 @@ module GovukPublishingComponents
106
122
  end
107
123
 
108
124
  def link_active(active)
109
- "gem-c-step-nav__link--active" if active
125
+ "gem-c-step-nav__list-item--active" if active
110
126
  end
111
127
  end
112
128
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '5.6.0'.freeze
2
+ VERSION = '5.7.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: 5.6.0
4
+ version: 5.7.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-03-20 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails