govuk_publishing_components 9.1.1 → 9.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: db15d537c17313a0793b88dc3ccac1f8ba3496e4a74b90243c0727e7b978354a
4
- data.tar.gz: 61a1abf7b80c7d18a6279ac941cced1642389918dbd4b5cef98d98d24b522d53
3
+ metadata.gz: a9be81dd115b4d1d6c4929ae4ab37967b49f0c754fc8f019b4f3c0d46b31c73b
4
+ data.tar.gz: 764428bcf5091952d69fa9672d09611da78707b753147462387ac2e8d435f427
5
5
  SHA512:
6
- metadata.gz: 6128034653da026744dc30526dda393da4d0ee1ed124d700b36b4e8833c244b8db785050af8ef35d313e50ec09ae31c1841d05f492a5af4c781ec57d9cb492bf
7
- data.tar.gz: 026ba2c40a3a797853af4586a29f2f9a82b02b1b887eef5364f7db7d8155af74d84988c22160f900c03a0f47f179866955a675a23e30272c90e00026b3d88557
6
+ metadata.gz: 5ece0a6bf7872b6adfc8a706825ba1e71953984554315c26539bff89781dcda35d6b7320db7be7b77a313433ca0417c2dc75587002ebeb7000dfee19d33443b2
7
+ data.tar.gz: 6cfa01de0ec959dc64a5c96e272df97a84258e67fa55665eb652f08e15d1e8de1408b37063f10ad1784b0637403531dca953f091774f5c94e71f191cdf6f56ef
@@ -25,6 +25,7 @@
25
25
  @import "components/label";
26
26
  @import "components/lead-paragraph";
27
27
  @import "components/notice";
28
+ @import "components/organisation-logo";
28
29
  @import "components/phase-banner";
29
30
  @import "components/previous-and-next-navigation";
30
31
  @import "components/radio";
@@ -15,9 +15,12 @@
15
15
  display: inline-block;
16
16
  }
17
17
 
18
+ .gem-c-document-list__item-title--context {
19
+ margin-right: $gutter-one-third;
20
+ }
21
+
18
22
  .gem-c-document-list__item-context {
19
23
  color: $grey-1;
20
- margin-left: $gutter-one-third;
21
24
  }
22
25
 
23
26
  .gem-c-document-list__item-description {
@@ -0,0 +1,141 @@
1
+ // Default logo corresponds with the "medium stacked" Whitehall equivalent
2
+ .gem-c-organisation-logo {
3
+ font-family: $helvetica-regular;
4
+ font-size: 13px;
5
+ line-height: (15 / 13);
6
+ font-weight: 400;
7
+
8
+ @include media(tablet) {
9
+ font-size: 18px;
10
+ line-height: 20px;
11
+ }
12
+ }
13
+
14
+ .gem-c-organisation-logo__container {
15
+ text-transform: none;
16
+ text-decoration: none;
17
+ display: block;
18
+ color: $black;
19
+ height: auto;
20
+ width: auto;
21
+
22
+ // Logo direction never changes, even for rtl content.
23
+ direction: ltr;
24
+ }
25
+
26
+ // Scale images on smaller viewports
27
+ .gem-c-organisation-logo__image {
28
+ max-width: 100%;
29
+ }
30
+
31
+ .gem-c-organisation-logo__crest {
32
+ // Default brand colour
33
+ border-left: 2px solid $black;
34
+ padding-top: 20px;
35
+ padding-left: 6px;
36
+
37
+ @include media(tablet) {
38
+ padding-top: 25px;
39
+ padding-left: 7px;
40
+ }
41
+
42
+ .brand--executive-office & {
43
+ border-left-width: 0;
44
+ padding-left: 0;
45
+ background-position: 0 0;
46
+ }
47
+ }
48
+
49
+ .gem-c-organisation-logo__name {
50
+ position: relative;
51
+ top: 3px;
52
+ }
53
+
54
+ .gem-c-organisation-logo__link:link,
55
+ .gem-c-organisation-logo__link:visited {
56
+ color: $black;
57
+ }
58
+
59
+ .gem-c-organisation-logo__link:hover,
60
+ .gem-c-organisation-logo__link:focus {
61
+ text-decoration: underline;
62
+ }
63
+
64
+ // all crest images are currently in whitehall
65
+ @mixin crest($crest) {
66
+ background: image-url('crests/#{$crest}_13px.png') no-repeat 5px 0;
67
+ background-size: auto 20px;
68
+
69
+ @include device-pixel-ratio() {
70
+ background-image: image-url('crests/#{$crest}_13px_x2.png');
71
+ }
72
+
73
+ @include media(tablet) {
74
+ background: image-url('crests/#{$crest}_18px.png') no-repeat 6px 0;
75
+ background-size: auto 26px;
76
+
77
+ @include device-pixel-ratio() {
78
+ background-image: image-url('crests/#{$crest}_18px_x2.png');
79
+ }
80
+ }
81
+ }
82
+
83
+ @mixin tall-crest {
84
+ padding-top: 25px;
85
+ background-size: auto 25px;
86
+
87
+ @include media(tablet) {
88
+ padding-top: 35px;
89
+ background-size: auto 34px;
90
+ }
91
+ }
92
+
93
+ .gem-c-organisation-logo__crest--dit {
94
+ @include crest('dit_crest');
95
+ }
96
+
97
+ .gem-c-organisation-logo__crest--bis {
98
+ @include crest('bis_crest');
99
+ }
100
+
101
+ .gem-c-organisation-logo__crest--hmrc {
102
+ @include crest('hmrc_crest');
103
+ }
104
+
105
+ .gem-c-organisation-logo__crest--ho {
106
+ @include crest('ho_crest');
107
+ @include tall-crest;
108
+ }
109
+
110
+ .gem-c-organisation-logo__crest--mod {
111
+ @include crest('mod_crest');
112
+ @include tall-crest;
113
+ }
114
+
115
+ .gem-c-organisation-logo__crest--single-identity,
116
+ .gem-c-organisation-logo__crest--eo,
117
+ .gem-c-organisation-logo__crest--org {
118
+ @include crest('org_crest');
119
+ }
120
+
121
+ .gem-c-organisation-logo__crest--portcullis {
122
+ @include crest('portcullis');
123
+ }
124
+
125
+ .gem-c-organisation-logo__crest--so {
126
+ @include crest('so_crest');
127
+ }
128
+
129
+ .gem-c-organisation-logo__crest--ukaea {
130
+ @include crest('ukaea_crest');
131
+ }
132
+
133
+ .gem-c-organisation-logo__crest--ukho {
134
+ @include crest('ukho');
135
+ @include tall-crest;
136
+ }
137
+
138
+ .gem-c-organisation-logo__crest--wales {
139
+ @include crest('wales_crest');
140
+ @include tall-crest;
141
+ }
@@ -2,6 +2,7 @@
2
2
  items ||= []
3
3
  margin_top_class = " gem-c-document-list--top-margin" if local_assigns[:margin_top]
4
4
  margin_bottom_class = " gem-c-document-list--bottom-margin" if local_assigns[:margin_bottom]
5
+ title_with_context_class = " gem-c-document-list__item-title--context"
5
6
 
6
7
  brand ||= false
7
8
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
@@ -12,24 +13,17 @@
12
13
  <li class="gem-c-document-list__item">
13
14
  <% if item[:link][:description] || item[:metadata] %>
14
15
  <h3 class="gem-c-document-list__item-title">
15
- <%=
16
- link_to(
17
- item[:link][:text],
18
- item[:link][:path],
19
- data: item[:link][:data_attributes],
20
- class: brand_helper.color_class
21
- )
22
- %>
16
+ <% end %>
17
+ <%=
18
+ link_to(
19
+ item[:link][:text],
20
+ item[:link][:path],
21
+ data: item[:link][:data_attributes],
22
+ class: "gem-c-document-list__item-title #{brand_helper.color_class} #{title_with_context_class if item[:link][:context]}"
23
+ )
24
+ %>
25
+ <% if item[:link][:description] || item[:metadata] %>
23
26
  </h3>
24
- <% else%>
25
- <%=
26
- link_to(
27
- item[:link][:text],
28
- item[:link][:path],
29
- data: item[:link][:data_attributes],
30
- class: "gem-c-document-list__item-title #{brand_helper.color_class}"
31
- )
32
- %>
33
27
  <% end %>
34
28
 
35
29
  <% if item[:link][:context] %>
@@ -0,0 +1,21 @@
1
+ <%
2
+ logo_helper = GovukPublishingComponents::Presenters::OrganisationLogoHelper.new(local_assigns)
3
+ brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(organisation[:brand])
4
+ organisation ||= {}
5
+ %>
6
+ <div
7
+ class="gem-c-organisation-logo <%= brand_helper.brand_class %>"
8
+ <%= "data-module=track-click" if organisation[:data_attributes] %>
9
+ >
10
+ <% if organisation[:url] %>
11
+ <%= link_to organisation[:url],
12
+ class: "#{logo_helper.logo_container_class} #{brand_helper.border_color_class}",
13
+ data: organisation[:data_attributes] do %>
14
+ <%= logo_helper.logo_content %>
15
+ <% end %>
16
+ <% else %>
17
+ <div class="<%= logo_helper.logo_container_class %> <%= brand_helper.border_color_class %>">
18
+ <%= logo_helper.logo_content %>
19
+ </div>
20
+ <% end %>
21
+ </div>
@@ -0,0 +1,164 @@
1
+ name: "Organisation logo"
2
+ description: "Organisation text with crest and branded border colour"
3
+ body: |
4
+ Organisation name must be provided with pre-formatted line breaks.
5
+ These cannot be inferred from the name alone.
6
+
7
+ Alternatively a custom organisation logo can be provided as an image.
8
+
9
+ Data tracking attributes can be provided to add tracking to each organisation logo.
10
+ This will only apply to organisations with a link. Example here: [with_data_attributes](/component-guide/organisation_logo/with_data_attributes)
11
+ accessibility_criteria: |
12
+ The crest image itself must be presentational and ignored by screen readers.
13
+
14
+ shared_accessibility_criteria:
15
+ - link
16
+ examples:
17
+ default:
18
+ data:
19
+ organisation:
20
+ name: 'Organisation<br>Name'
21
+ url: 'http://www.gov.uk'
22
+ single_identity:
23
+ data:
24
+ organisation:
25
+ name: 'Single Identity'
26
+ url: 'http://www.gov.uk'
27
+ crest: 'single-identity'
28
+ attorney_generals_office:
29
+ data:
30
+ organisation:
31
+ name: 'Attorney <br>General’s <br>Office'
32
+ url: '/government/organisations/attorney-generals-office'
33
+ brand: 'attorney-generals-office'
34
+ crest: 'single-identity'
35
+ department_for_business_innovation_and_skills:
36
+ data:
37
+ organisation:
38
+ name: 'Department <br>for Business<br>Innovation &amp; Skills'
39
+ url: '/government/organisations/department-for-business-innovation-skills'
40
+ brand: 'department-for-business-innovation-skills'
41
+ crest: 'bis'
42
+ department_for_international_trade:
43
+ data:
44
+ organisation:
45
+ name: 'Department for<br>International Trade'
46
+ url: '/government/organisations/department-for-international-trade'
47
+ brand: 'department-for-international-trade'
48
+ crest: 'dit'
49
+ executive_office:
50
+ data:
51
+ organisation:
52
+ name: Prime Minister's Office, 10 Downing Street
53
+ url: '/government/organisations/prime-ministers-office-10-downing-street'
54
+ brand: 'executive-office'
55
+ crest: 'eo'
56
+ home_office:
57
+ data:
58
+ organisation:
59
+ name: 'Home Office'
60
+ url: '/government/organisations/home-office'
61
+ brand: 'home-office'
62
+ crest: 'ho'
63
+ ministry_of_defence:
64
+ data:
65
+ organisation:
66
+ name: 'Ministry<br>of Defence'
67
+ url: '/government/organisations/ministry-of-defence'
68
+ brand: 'ministry-of-defence'
69
+ crest: 'mod'
70
+ office_of_the_advocate_general_for_scotland:
71
+ data:
72
+ organisation:
73
+ name: 'Office of the<br>Advocate General<br>for Scotland'
74
+ url: '/government/organisations/office-of-the-advocate-general-for-scotland'
75
+ brand: 'office-of-the-advocate-general-for-scotland'
76
+ crest: 'so'
77
+ office_of_the_leader_of_the_house_of_commons:
78
+ data:
79
+ organisation:
80
+ name: 'Office of the <br>Leader of the <br>House of Commons'
81
+ url: '/government/organisations/the-office-of-the-leader-of-the-house-of-commons'
82
+ brand: 'the-office-of-the-leader-of-the-house-of-commons'
83
+ crest: 'portcullis'
84
+ wales_office:
85
+ data:
86
+ organisation:
87
+ name: 'Wales Office<br>Swyddfa Cymru'
88
+ url: '/government/organisations/wales-office'
89
+ brand: 'wales_office'
90
+ crest: 'wales'
91
+ uk_atomic_energy_authority:
92
+ data:
93
+ organisation:
94
+ name: 'UK Atomic <br>Energy <br>Authority'
95
+ url: '/government/organisations/uk-atomic-energy-authority'
96
+ brand: 'department-for-business-innovation-skills'
97
+ crest: 'ukaea'
98
+ wales_office:
99
+ data:
100
+ organisation:
101
+ name: 'Wales Office<br>Swyddfa Cymru'
102
+ url: '/government/organisations/wales-office'
103
+ brand: 'wales_office'
104
+ crest: 'wales'
105
+ hm_revenue_customs:
106
+ data:
107
+ organisation:
108
+ name: 'HM Revenue<br>&amp; Customs'
109
+ url: '/government/organisations/hm-revenue-customs'
110
+ brand: 'hm-revenue-customs'
111
+ crest: 'hmrc'
112
+ bona_vacantia:
113
+ data:
114
+ organisation:
115
+ name: 'Bona Vacantia'
116
+ url: '/government/organisations/bona-vacantia'
117
+ brand: 'attorney-generals-office'
118
+ crest: 'org'
119
+ treasury_solicitors_office:
120
+ data:
121
+ organisation:
122
+ name: 'Treasury <br>Solicitor’s <br>Department'
123
+ url: '/government/organisations/treasury-solicitor-s-department'
124
+ brand: 'attorney-generals-office'
125
+ crest: 'org'
126
+ land_registry:
127
+ data:
128
+ organisation:
129
+ name: 'Land Registry'
130
+ url: '/government/organisations/land-registry'
131
+ brand: 'department-for-business-innovation-skills'
132
+ crest: null
133
+ image:
134
+ url: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/organisation/logo/69/HMLR_logo.png'
135
+ alt_text: 'Land Registry'
136
+ hm_prison_service:
137
+ data:
138
+ organisation:
139
+ name: 'HM Prison Service'
140
+ url: '/government/organisations/hm-prison-service'
141
+ brand: 'ministry-of-justice'
142
+ image:
143
+ url: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/organisation/logo/321/HMPS.jpg'
144
+ alt_text: 'HM Prison Service'
145
+ with_data_attributes:
146
+ data:
147
+ organisation:
148
+ name: Cabinet Office
149
+ url: '/government/organisations/cabinet-office'
150
+ brand: cabinet-office
151
+ crest: 'single-identity'
152
+ data_attributes:
153
+ track_category: "navOrganisationLinkClicked"
154
+ track_action: 1
155
+ track_label: '/government/organisations/cabinet-office'
156
+ track_options:
157
+ dimension28: 2
158
+ dimension29: Cabinet Office
159
+ without_a_link:
160
+ data:
161
+ organisation:
162
+ name: Cabinet Office
163
+ brand: cabinet-office
164
+ crest: 'single-identity'
@@ -19,6 +19,7 @@ require "govuk_publishing_components/presenters/schema_org"
19
19
  require "govuk_publishing_components/presenters/heading_helper"
20
20
  require "govuk_publishing_components/presenters/contents_list_helper"
21
21
  require "govuk_publishing_components/presenters/image_card_helper"
22
+ require "govuk_publishing_components/presenters/organisation_logo_helper"
22
23
 
23
24
  require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
24
25
  require "govuk_publishing_components/app_helpers/brand_helper"
@@ -0,0 +1,36 @@
1
+ module GovukPublishingComponents
2
+ module Presenters
3
+ class OrganisationLogoHelper
4
+ include ActionView::Helpers
5
+ include ActionView::Context
6
+
7
+ attr_reader :name, :url, :crest, :image, :logo_image_src, :logo_image_alt
8
+
9
+ def initialize(local_assigns)
10
+ @name = local_assigns[:organisation][:name]
11
+ @url = local_assigns[:organisation][:url]
12
+ @crest = local_assigns[:organisation][:crest]
13
+ @image = local_assigns[:organisation][:image] || false
14
+ if @image
15
+ @logo_image_src = local_assigns[:organisation][:image][:url] || false
16
+ @logo_image_alt = local_assigns[:organisation][:image][:alt_text] || false
17
+ end
18
+ end
19
+
20
+ def logo_content
21
+ if image
22
+ image_tag(logo_image_src, alt: logo_image_alt, class: "gem-c-organisation-logo__image")
23
+ else
24
+ content_tag('span', name, class: "gem-c-organisation-logo__name")
25
+ end
26
+ end
27
+
28
+ def logo_container_class
29
+ logo_class = "gem-c-organisation-logo__container"
30
+ logo_class = "#{logo_class} gem-c-organisation-logo__link" if url
31
+ logo_class = "#{logo_class} gem-c-organisation-logo__crest gem-c-organisation-logo__crest--#{crest}" if crest
32
+ logo_class
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '9.1.1'.freeze
2
+ VERSION = '9.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.1
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -347,6 +347,7 @@ files:
347
347
  - app/assets/stylesheets/govuk_publishing_components/components/_label.scss
348
348
  - app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss
349
349
  - app/assets/stylesheets/govuk_publishing_components/components/_notice.scss
350
+ - app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss
350
351
  - app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss
351
352
  - app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss
352
353
  - app/assets/stylesheets/govuk_publishing_components/components/_radio.scss
@@ -436,6 +437,7 @@ files:
436
437
  - app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb
437
438
  - app/views/govuk_publishing_components/components/_meta_tags.html.erb
438
439
  - app/views/govuk_publishing_components/components/_notice.html.erb
440
+ - app/views/govuk_publishing_components/components/_organisation_logo.html.erb
439
441
  - app/views/govuk_publishing_components/components/_phase_banner.html.erb
440
442
  - app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb
441
443
  - app/views/govuk_publishing_components/components/_radio.html.erb
@@ -472,6 +474,7 @@ files:
472
474
  - app/views/govuk_publishing_components/components/docs/machine_readable_metadata.yml
473
475
  - app/views/govuk_publishing_components/components/docs/meta_tags.yml
474
476
  - app/views/govuk_publishing_components/components/docs/notice.yml
477
+ - app/views/govuk_publishing_components/components/docs/organisation_logo.yml
475
478
  - app/views/govuk_publishing_components/components/docs/phase_banner.yml
476
479
  - app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml
477
480
  - app/views/govuk_publishing_components/components/docs/radio.yml
@@ -517,6 +520,7 @@ files:
517
520
  - lib/govuk_publishing_components/presenters/machine_readable/page.rb
518
521
  - lib/govuk_publishing_components/presenters/machine_readable/person_schema.rb
519
522
  - lib/govuk_publishing_components/presenters/meta_tags.rb
523
+ - lib/govuk_publishing_components/presenters/organisation_logo_helper.rb
520
524
  - lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb
521
525
  - lib/govuk_publishing_components/presenters/related_navigation_helper.rb
522
526
  - lib/govuk_publishing_components/presenters/rummager_taxonomy_sidebar_links.rb