govuk_publishing_components 63.3.0 → 63.3.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6accce7654a1f778de97ed1e1c305ea2b61ba6e1cd65c18003179d298075dd1f
|
|
4
|
+
data.tar.gz: 17f5ec5d9b2ce4f0dac0f16cf3de381b575bd8c24ce5a1d295dc264e14203829
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f747916bfc169df32c1c8bf40630a8c03855c7666b467072cb1a21cd413d1f5ffacb8117b1c051f98402ad90f8ae8c205a2cacfeeded10d52a5dab37031810de
|
|
7
|
+
data.tar.gz: a16291d0bf67efc71960cc73c18d721b7f9d629b72ba23e35dcd3a42e9b84165aa64bb2a5e0817de2826b7175cb5e9adb514bdc7c998201be951226eb51be891
|
|
@@ -18,10 +18,6 @@ shared_accessibility_criteria:
|
|
|
18
18
|
- link
|
|
19
19
|
examples:
|
|
20
20
|
default:
|
|
21
|
-
data:
|
|
22
|
-
organisation:
|
|
23
|
-
name: 'Organisation<br>Name'
|
|
24
|
-
with_a_link:
|
|
25
21
|
data:
|
|
26
22
|
organisation:
|
|
27
23
|
name: 'Organisation<br>Name'
|
|
@@ -162,6 +158,12 @@ examples:
|
|
|
162
158
|
image:
|
|
163
159
|
url: 'https://assets.publishing.service.gov.uk/media/6850134301d3b0e7b62da740/hmps_25_gov_240x188.png'
|
|
164
160
|
alt_text: 'HM Prison Service'
|
|
161
|
+
without_a_link:
|
|
162
|
+
data:
|
|
163
|
+
organisation:
|
|
164
|
+
name: Cabinet Office
|
|
165
|
+
brand: cabinet-office
|
|
166
|
+
crest: 'single-identity'
|
|
165
167
|
as_a_heading:
|
|
166
168
|
description: The `heading_level` option takes a number from 1 to 6.
|
|
167
169
|
data:
|
|
@@ -4,44 +4,40 @@ module GovukPublishingComponents
|
|
|
4
4
|
include ActionView::Helpers
|
|
5
5
|
include ActionView::Context
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
raise(ArgumentError, "Component requires an organisation including a name") unless minimum_for_component?(local_assigns)
|
|
7
|
+
attr_reader :name, :url, :crest, :image, :logo_image_src, :logo_image_alt, :hide_underline
|
|
9
8
|
|
|
9
|
+
def initialize(local_assigns)
|
|
10
10
|
@name = local_assigns[:organisation][:name]
|
|
11
11
|
@url = local_assigns[:organisation][:url]
|
|
12
12
|
@crest = local_assigns[:organisation][:crest]
|
|
13
13
|
@image = local_assigns[:organisation][:image] || false
|
|
14
14
|
if @image
|
|
15
|
-
@logo_image_src = local_assigns[:organisation][:image][:url] ||
|
|
16
|
-
@logo_image_alt = local_assigns[:organisation][:image][:alt_text] ||
|
|
15
|
+
@logo_image_src = local_assigns[:organisation][:image][:url] || false
|
|
16
|
+
@logo_image_alt = local_assigns[:organisation][:image][:alt_text] || false
|
|
17
17
|
end
|
|
18
18
|
@hide_underline = local_assigns[:hide_underline] || false
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def logo_content
|
|
22
|
-
if
|
|
23
|
-
image_tag(
|
|
22
|
+
if image
|
|
23
|
+
image_tag(logo_image_src, alt: logo_image_alt, class: "gem-c-organisation-logo__image")
|
|
24
24
|
else
|
|
25
|
-
content_tag("span",
|
|
25
|
+
content_tag("span", name, class: "gem-c-organisation-logo__name")
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def logo_container_class
|
|
30
|
-
logo_class =
|
|
31
|
-
logo_class
|
|
32
|
-
logo_class
|
|
33
|
-
logo_class
|
|
34
|
-
logo_class
|
|
30
|
+
logo_class = "gem-c-organisation-logo__container"
|
|
31
|
+
logo_class = "#{logo_class} gem-c-organisation-logo__link" if url
|
|
32
|
+
logo_class = "#{logo_class} gem-c-organisation-logo__link-hide-underline" if hide_underline
|
|
33
|
+
logo_class = "#{logo_class} gem-c-organisation-logo__crest gem-c-organisation-logo__crest--#{crest}" if crest_has_visual_identity?
|
|
34
|
+
logo_class
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
private
|
|
38
38
|
|
|
39
|
-
def minimum_for_component?(options)
|
|
40
|
-
true unless !options[:organisation] || options[:organisation] && !options[:organisation][:name]
|
|
41
|
-
end
|
|
42
|
-
|
|
43
39
|
def crest_has_visual_identity?
|
|
44
|
-
|
|
40
|
+
crest.present? && !%w[no-identity custom].include?(crest)
|
|
45
41
|
end
|
|
46
42
|
end
|
|
47
43
|
end
|