govuk_publishing_components 17.1.1 → 17.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67ef1e7cfae1f60d9524d55cc3634ac8b6c6f681869c0505b1cc5e848d649976
4
- data.tar.gz: 51361825126e2e44b7f553dcca8c4f18e6bb28d122e8ccf6aa921824258edb27
3
+ metadata.gz: 33f5dbdf1676f065363ebbc65af431eb4bd35498ee823d8b65897d1b0478bd8c
4
+ data.tar.gz: 7f89b1060016427871d1716dfdf2b4e677d23b1331be55f22f77850c9483804d
5
5
  SHA512:
6
- metadata.gz: c4a98672525cc574a6d860b3e25d5bb0709aa24b0ab7b79ba9fb0599b5956f1879f6a4b36efad1bcf613849bfefb9cbf67aa4fef4d7977af180c9788ff2f4381
7
- data.tar.gz: 62f47a6a27a24894c85f1cb95b2b0ca39068a3a16ce28f713941f925a8915a13018b54f0ddf93a04ef295c6f5b180a81ef712f5aea75d8d21e913aad586a33cc
6
+ metadata.gz: 2ee4fab8d517368ba42560bcbb2fabc3f5e67bdc2af25e18e131d41f2b10d5aeffe371c0d64a2a09eda2835c9eda0d89452ebd3de179099ca725f60e440f1fab
7
+ data.tar.gz: e728271a0a22df07e877afa58892cda0f99f5a5e7f2078076f36574b20751cbe0360ed7d6e3e98047a04901fd77680db88101ffbacd118896004e66444abab82
data/README.md CHANGED
@@ -59,17 +59,17 @@ bundle exec yard server --reload
59
59
  The default rake task runs all tests:
60
60
 
61
61
  ```
62
- bundle exec rake
62
+ bin/rake
63
63
  ```
64
64
 
65
65
  Javascript is tested using Jasmine and the [Jasmine gem](https://github.com/pivotal/jasmine-gem). Tests can be run either in the browser or on the command line via the dummy app’s tasks:
66
66
 
67
67
  ```sh
68
68
  # browser
69
- bundle exec rake app:jasmine
69
+ bin/rake app:jasmine
70
70
 
71
71
  # command line
72
- bundle exec rake app:jasmine:ci
72
+ bin/rake app:jasmine:ci
73
73
  ```
74
74
 
75
75
  ## Licence
@@ -39,10 +39,18 @@
39
39
 
40
40
  .gem-c-document-list__item-description {
41
41
  @include govuk-text-colour;
42
- @include govuk-font($size: 16, $line-height: 1.5);
43
42
  margin: 0 0 5px 0;
44
43
  }
45
44
 
45
+ .gem-c-document-list__subtext {
46
+ margin: govuk-spacing(1) 0 0 0;
47
+ }
48
+
49
+ .gem-c-document-list__item-description,
50
+ .gem-c-document-list__subtext {
51
+ @include govuk-font($size: 16, $line-height: 1.5);
52
+ }
53
+
46
54
  .gem-c-document-list__item-metadata {
47
55
  padding: 0;
48
56
  }
@@ -72,3 +80,19 @@
72
80
  width: 100%;
73
81
  margin-right: 25px;
74
82
  }
83
+
84
+ .gem-c-document-list__item--highlight {
85
+ border: 1px solid govuk-colour("grey-2");
86
+ padding: govuk-spacing(6);
87
+ margin-bottom: govuk-spacing(6);
88
+
89
+ .gem-c-document-list__item-title {
90
+ @include govuk-font(24, bold);
91
+ }
92
+ }
93
+
94
+ .gem-c-document-list__highlight-text {
95
+ @include govuk-font(16, bold);
96
+ margin: 0 0 govuk-spacing(3) 0;
97
+
98
+ }
@@ -1,5 +1,5 @@
1
1
  .gem-c-feedback {
2
- max-width: 960px;
2
+ max-width: $govuk-page-width;
3
3
  margin: 0 auto;
4
4
 
5
5
  .visually-hidden {
@@ -8,10 +8,10 @@
8
8
  }
9
9
 
10
10
  .gem-c-feedback--top-margin {
11
- margin-top: $gutter;
11
+ margin-top: govuk-spacing(6);
12
12
 
13
- @include media(tablet) {
14
- margin-top: $gutter * 2;
13
+ @include govuk-media-query($from: tablet) {
14
+ margin-top: govuk-spacing(9);
15
15
  }
16
16
  }
17
17
 
@@ -33,25 +33,23 @@
33
33
  }
34
34
  }
35
35
 
36
- .gem-c-feedback__grid-row {
37
- @extend %grid-row;
38
- }
36
+ @include govuk-grid-row($class: "gem-c-feedback__grid-row");
39
37
 
40
38
  .gem-c-feedback__column-two-thirds {
41
- @include grid-column(2 / 3);
39
+ @include govuk-grid-column(two-thirds, $class: false)
42
40
  }
43
41
 
44
42
  .gem-c-feedback__prompt {
45
- @extend %contain-floats;
46
- background-color: $govuk-blue;
47
- color: $white;
48
- padding: $gutter-one-third $gutter-half 0;
43
+ @include govuk-clearfix;
44
+ background-color: govuk-colour("blue");
45
+ color: govuk-colour("white");
46
+ padding: govuk-spacing(2) govuk-spacing(3) 0;
49
47
  outline: 0;
50
48
  }
51
49
 
52
50
  .gem-c-feedback__prompt-question,
53
51
  .gem-c-feedback__prompt-success {
54
- @include bold-19;
52
+ @include govuk-font(19, $weight: bold);
55
53
  display: inline-block;
56
54
 
57
55
  // There's a global h3 rule in some layouts that interferes with this component
@@ -61,27 +59,27 @@
61
59
  outline: 0;
62
60
  }
63
61
 
64
- @include media(tablet) {
65
- @include bold-16;
62
+ @include govuk-media-query($from: tablet) {
63
+ @include govuk-font(16, $weight: bold);
66
64
  float: left;
67
65
  }
68
66
  }
69
67
 
70
68
  .gem-c-feedback__prompt-link {
71
69
  @include govuk-link-common;
72
- @include core-19;
73
- margin-left: $gutter-half;
70
+ @include govuk-font(19);
71
+ margin-left: govuk-spacing(3);
74
72
 
75
- @include media(tablet) {
76
- @include core-16;
73
+ @include govuk-media-query($from: tablet) {
74
+ @include govuk-font(16);
77
75
  float: left; // needed to ensure vertical alignment consistent with prompt-link--wrong
78
- margin-left: $gutter-one-third;
76
+ margin-left: govuk-spacing(2);
79
77
  }
80
78
  }
81
79
 
82
80
  .gem-c-feedback__prompt-link:link,
83
81
  .gem-c-feedback__prompt-link:visited {
84
- color: $white;
82
+ color: govuk-colour("white");
85
83
 
86
84
  &:focus {
87
85
  color: $govuk-focus-text-colour;
@@ -91,43 +89,43 @@
91
89
  .gem-c-feedback__prompt-link--wrong {
92
90
  display: block;
93
91
  clear: both;
94
- margin-top: $gutter-half;
92
+ margin-top: govuk-spacing(3);
95
93
  margin-left: 0;
96
94
 
97
- @include media(tablet) {
95
+ @include govuk-media-query($from: tablet) {
98
96
  float: right;
99
97
  clear: none;
100
98
  margin-top: 0;
101
- margin-left: $gutter-one-third;
99
+ margin-left: govuk-spacing(2);
102
100
  }
103
101
  }
104
102
 
105
103
  .gem-c-feedback__error-summary {
106
- margin-bottom: $gutter-half;
107
- padding: $gutter-half;
108
- border: solid 4px $error-colour;
104
+ margin-bottom: govuk-spacing(3);
105
+ padding: govuk-spacing(3);
106
+ border: solid $govuk-border-width-mobile $govuk-error-colour;
109
107
  clear: both;
110
108
 
111
109
  &:focus {
112
- outline: solid 3px $focus-colour;
110
+ outline: solid 3px $govuk-focus-colour;
113
111
  }
114
112
 
115
- @include media(tablet) {
116
- border-width: 5px;
113
+ @include govuk-media-query($from: tablet) {
114
+ border-width: $govuk-border-width;
117
115
  }
118
116
 
119
117
  // this comes from the backend so we can't put a class on it
120
118
  h2,
121
119
  .gem-c-feedback__heading {
122
120
  @include govuk-text-colour;
123
- @include bold-24;
121
+ @include govuk-font(24, $weight: bold);
124
122
  margin: 0;
125
123
  }
126
124
 
127
125
  p {
128
126
  @include govuk-text-colour;
129
- @include core-19;
130
- margin: $gutter-one-third 0;
127
+ @include govuk-font(19);
128
+ margin: govuk-spacing(2) 0;
131
129
  }
132
130
 
133
131
  a {
@@ -136,60 +134,60 @@
136
134
  }
137
135
 
138
136
  .gem-c-feedback__error-message {
139
- @include bold-19;
137
+ @include govuk-font(19, $weight: bold);
140
138
  display: block;
141
139
  padding: 4px 0 0;
142
- color: $error-colour;
140
+ color: $govuk-error-colour;
143
141
  }
144
142
 
145
143
  .gem-c-feedback__form {
146
- margin-top: $gutter-half;
147
- padding: $gutter-half 0;
148
- border-top: $gutter-one-third solid $govuk-blue;
144
+ margin-top: govuk-spacing(3);
145
+ padding: govuk-spacing(3) 0;
146
+ border-top: govuk-spacing(2) solid govuk-colour("blue");
149
147
 
150
- @include media(tablet) {
151
- padding: $gutter 0;
148
+ @include govuk-media-query($from: tablet) {
149
+ padding: govuk-spacing(6) 0;
152
150
  }
153
151
  }
154
152
 
155
153
  .gem-c-feedback__form-heading {
156
154
  @include govuk-text-colour;
157
- @include bold-24;
158
- margin: 0 0 $gutter-half 0;
155
+ @include govuk-font(24, $weight: bold);
156
+ margin: 0 0 govuk-spacing(3) 0;
159
157
  }
160
158
 
161
159
  .gem-c-feedback__form-paragraph {
162
160
  @include govuk-text-colour;
163
- @include core-19;
164
- margin: 0 0 $gutter 0;
161
+ @include govuk-font(19);
162
+ margin: 0 0 govuk-spacing(6) 0;
165
163
  }
166
164
 
167
165
  .gem-c-feedback__form-label {
168
- @include core-16;
166
+ @include govuk-font(16);
169
167
  display: block;
170
- padding-bottom: $gutter-half;
168
+ padding-bottom: govuk-spacing(3);
171
169
  }
172
170
 
173
171
  .gem-c-feedback__close {
174
172
  @include govuk-link-common;
175
173
  @include govuk-link-style-default;
176
- @include core-19;
174
+ @include govuk-font(19);
177
175
  float: right;
178
- margin: 0 0 $gutter-one-third 0;
176
+ margin: 0 0 govuk-spacing(2) 0;
179
177
 
180
- @include media(tablet) {
178
+ @include govuk-media-query($from: tablet) {
181
179
  padding-top: 0;
182
180
  }
183
181
  }
184
182
 
185
183
  .gem-c-feedback__email-link {
186
184
  display: block;
187
- margin-top: $gutter-half;
185
+ margin-top: govuk-spacing(3);
188
186
 
189
- @include media(tablet) {
187
+ @include govuk-media-query($from: tablet) {
190
188
  display: inline-block;
191
189
  margin-top: 0;
192
- margin-left: $gutter-half;
190
+ margin-left: govuk-spacing(3);
193
191
  }
194
192
  }
195
193
 
@@ -2,7 +2,6 @@ $stroke-width: 2px;
2
2
  $stroke-width-large: 3px;
3
3
  $number-circle-size: 26px;
4
4
  $number-circle-size-large: 35px;
5
- $dot-size: 16px;
6
5
  $top-border: solid 2px $grey-3;
7
6
 
8
7
  @mixin step-nav-vertical-line ($line-style: solid) {
@@ -372,27 +371,25 @@ $top-border: solid 2px $grey-3;
372
371
  z-index: 5;
373
372
  top: .6em; // position the dot to align with the first row of text in the link
374
373
  left: -($gutter + $gutter-half);
375
- margin-left: ($number-circle-size / 2) - ($dot-size / 2);
376
- width: $dot-size;
377
- height: $dot-size;
378
- margin-top: -($dot-size / 2);
374
+ margin-top: -($stroke-width / 2);
375
+ margin-left: ($number-circle-size / 2);
376
+ width: $number-circle-size / 2;
377
+ height: $stroke-width;
379
378
  background: $black;
380
- border: solid 2px $white;
381
- border-radius: 100px;
382
379
  }
383
380
 
384
381
  .gem-c-step-nav--large & {
385
382
  @include media(tablet) {
386
383
  &:before {
387
384
  left: -($gutter * 2);
388
- margin-left: ($number-circle-size-large / 2) - ($dot-size / 2);
385
+ margin-left: ($number-circle-size-large / 2);
386
+ height: $stroke-width-large;
389
387
  }
390
388
  }
391
389
  }
392
390
 
393
391
  .gem-c-step-nav__link {
394
392
  @include govuk-link-style-text;
395
- text-decoration: none;
396
393
  }
397
394
  }
398
395
 
@@ -14,7 +14,12 @@
14
14
  <ol class="gem-c-document-list<%= margin_bottom_class %><%= margin_top_class %>">
15
15
  <% end %>
16
16
  <% items.each do |item| %>
17
- <li class="gem-c-document-list__item<%= within_multitype_list_class %> <%= brand_helper.brand_class %>">
17
+ <% highlight_class = " gem-c-document-list__item--highlight" if item[:highlight] %>
18
+
19
+ <li class="gem-c-document-list__item<%= within_multitype_list_class %> <%= brand_helper.brand_class %> <%= highlight_class %>">
20
+ <% if item[:highlight] && item[:highlight_text] %>
21
+ <p class='gem-c-document-list__highlight-text'><%= item[:highlight_text] %></p>
22
+ <% end %>
18
23
  <%=
19
24
  link_to(
20
25
  item[:link][:text],
@@ -47,6 +52,10 @@
47
52
  <% end %>
48
53
  </ul>
49
54
  <% end %>
55
+
56
+ <% if item[:subtext] %>
57
+ <p class="gem-c-document-list__subtext"><%= item[:subtext] %></p>
58
+ <% end %>
50
59
  </li>
51
60
  <% end %>
52
61
  <% unless within_multitype_list %>
@@ -76,6 +76,27 @@ examples:
76
76
  text: 'Become an apprentice'
77
77
  path: '/become-an-apprentice'
78
78
  description: 'Becoming an apprentice - what to expect, apprenticeship levels, pay and training, making an application, complaining about an apprenticeship.'
79
+ - link:
80
+ text: 'Become a journeyman'
81
+ path: '/become-a-journeyman'
82
+ description: 'Becoming a journeyman - what to expect, what to take, pay and training, making an application, complaining about being a journeyman.'
83
+ with_description_and_metadata:
84
+ data:
85
+ items:
86
+ - link:
87
+ text: 'School behaviour and attendance: parental responsibility measures'
88
+ path: '/government/publications/parental-responsibility-measures-for-behaviour-and-attendance'
89
+ description: 'The responsibilities parents have relating to school behaviour and attendance.'
90
+ metadata:
91
+ public_updated_at: 2017-01-05 14:50:33
92
+ document_type: 'Statutory guidance'
93
+ - link:
94
+ text: 'School exclusion'
95
+ path: '/government/publications/school-exclusion'
96
+ description: 'Rules governing school exclusion.'
97
+ metadata:
98
+ public_updated_at: 2017-07-19 15:01:48
99
+ document_type: 'Statutory guidance'
79
100
  with_branding:
80
101
  description: Where this component could be used on an organisation page (such as the [Attorney General's Office](https://www.gov.uk/government/organisations/attorney-generals-office)) branding can be applied for link colours and border colours. See the [branding documentation](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) for more details.
81
102
  data:
@@ -115,6 +136,48 @@ examples:
115
136
  path: '/government/organisations/advisory-committee-on-the-microbiological-safety-of-food'
116
137
  context: 'moving to GOV.UK'
117
138
  description: "Works with 4 agencies and public bodies"
139
+ with_subtext:
140
+ description: This is used on finders to highlight search results from past governments.
141
+ data:
142
+ items:
143
+ - link:
144
+ text: 'Department for Education – Statistics at DfE'
145
+ path: '/government/organisations/department-for-education/about/statistics'
146
+ description: 'The Department for Education publishes official statistics on education and children.'
147
+ metadata:
148
+ public_updated_at: 2017-07-19 15:01:48
149
+ document_type: 'Corporate information'
150
+ subtext: 'First published during the 2007 Labour Government'
151
+ - link:
152
+ text: 'State-funded school inspections and outcomes: management information'
153
+ path: '/government/organisations/department-for-education/about/statistics'
154
+ description: 'Management information published monthly and a one-off publication of inspections and outcomes from 2005 to 2015.'
155
+ metadata:
156
+ public_updated_at: 2017-07-19 15:01:48
157
+ document_type: 'Statistical data set'
158
+ subtext: 'First published during the 1996 Conservative Government'
159
+ highlighted_result:
160
+ description: Highlight one or more of the items in the list. This is used on finders to provide a 'top result' for a search. The `highlight_text` parameter is optional.
161
+ data:
162
+ items:
163
+ - link:
164
+ text: 'Department for Education – Statistics at DfE'
165
+ path: '/government/organisations/department-for-education/about/statistics'
166
+ description: 'The Department for Education publishes official statistics on education and children.'
167
+ metadata:
168
+ public_updated_at: 2017-07-19 15:01:48
169
+ document_type: 'Corporate information'
170
+ subtext: 'First published during the 2007 Labour Government'
171
+ highlight: true
172
+ highlight_text: 'Most relevant result'
173
+ - link:
174
+ text: 'State-funded school inspections and outcomes: management information'
175
+ path: '/government/organisations/department-for-education/about/statistics'
176
+ description: 'Management information published monthly and a one-off publication of inspections and outcomes from 2005 to 2015.'
177
+ metadata:
178
+ public_updated_at: 2017-07-19 15:01:48
179
+ document_type: 'Statistical data set'
180
+ subtext: 'First published during the 1996 Conservative Government'
118
181
  right_to_left:
119
182
  data:
120
183
  items:
@@ -69,6 +69,28 @@ examples:
69
69
  - title: "Dodgy Wands Commission"
70
70
  base_path: "/dodgy-wands-commission"
71
71
  schema: :organisation
72
+ organisation_schema_with_people:
73
+ data:
74
+ content_item:
75
+ title: "Ministry of Organisation"
76
+ base_path: "/foo"
77
+ details:
78
+ ordered_ministers:
79
+ - name_prefix: "Minister"
80
+ name: "Rufus Scrimgeour MP"
81
+ role: "Minister for Magic"
82
+ href: "/rufus-scrimgeour"
83
+ role_href: "/minister-for-magic"
84
+ image:
85
+ url: "https://images.gov.uk/rufus.jpg"
86
+ - name_prefix: "Minister"
87
+ name: "Rufus Scrimgeour MP"
88
+ role: "Head of Auror Office"
89
+ href: "/rufus-scrimgeour"
90
+ role_href: "/head-of-auror-office"
91
+ image:
92
+ url: "https://images.gov.uk/rufus.jpg"
93
+ schema: :organisation
72
94
  search_results_page_schema:
73
95
  data:
74
96
  content_item:
@@ -18,11 +18,76 @@ module GovukPublishingComponents
18
18
  },
19
19
  "name" => page.title,
20
20
  "description" => page.description || page.body,
21
- }.merge(parent_organisations).merge(sub_organisations).merge(search_action)
21
+ }
22
+ .merge(members)
23
+ .merge(parent_organisations)
24
+ .merge(sub_organisations)
25
+ .merge(search_action)
22
26
  end
23
27
 
24
28
  private
25
29
 
30
+ def members
31
+ return {} unless ministers.present?
32
+
33
+ members = ministers_with_grouped_roles.map do |person, roles|
34
+ person.merge("hasOccupation" => roles)
35
+ end
36
+
37
+ {
38
+ "member" => members
39
+ }
40
+ end
41
+
42
+ def ministers
43
+ page.content_item.dig("details", "ordered_ministers") || []
44
+ end
45
+
46
+ def ministers_with_grouped_roles
47
+ ministers.reduce({}) do |grouped, minister|
48
+ person_schema = person_schema_for_minister(minister)
49
+
50
+ if grouped.has_key? person_schema
51
+ grouped[person_schema] << role_for_minister(minister)
52
+ else
53
+ grouped[person_schema] = [role_for_minister(minister)]
54
+ end
55
+ grouped
56
+ end
57
+ end
58
+
59
+ def person_schema_for_minister(minister)
60
+ {
61
+ "@type" => "Person",
62
+ "honorificPrefix" => minister["name_prefix"],
63
+ "image" => minister.dig("image", "url"),
64
+ "name" => minister["name"],
65
+ "url" => minister_url(minister)
66
+ }
67
+ end
68
+
69
+ def role_for_minister(minister)
70
+ return {} unless minister["role"].present?
71
+
72
+ {
73
+ "@type" => "Role",
74
+ "name" => minister["role"],
75
+ "url" => role_url(minister)
76
+ }
77
+ end
78
+
79
+ def minister_url(minister)
80
+ "#{website_root}#{minister['href']}"
81
+ end
82
+
83
+ def role_url(minister)
84
+ "#{website_root}#{minister['role_href']}"
85
+ end
86
+
87
+ def website_root
88
+ @website_root ||= Plek.new.website_root
89
+ end
90
+
26
91
  def parent_organisations
27
92
  related_organisations("ordered_parent_organisations", "parentOrganization")
28
93
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '17.1.1'.freeze
2
+ VERSION = '17.2.0'.freeze
3
3
  end
@@ -49,7 +49,7 @@
49
49
  "/"
50
50
  ],
51
51
  "_resolved": "git://github.com/alphagov/accessible-autocomplete.git#3523dd9fffc70cbd9f6f555f75863c33a709f49e",
52
- "_shasum": "43f3031501fd6d8434749b5ad34c3f8ee23d991f",
52
+ "_shasum": "828d0b174da2c7779fb957d3c7240807bc93012a",
53
53
  "_shrinkwrap": null,
54
54
  "_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
55
55
  "_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
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: 17.1.1
4
+ version: 17.2.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-06-17 00:00:00.000000000 Z
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters