govuk-components 6.3.1 → 6.4.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 +4 -4
- data/README.md +1 -1
- data/app/components/govuk_component/generic_header_component.html.erb +18 -0
- data/app/components/govuk_component/generic_header_component.rb +36 -0
- data/app/components/govuk_component/header_component.html.erb +2 -2
- data/app/components/govuk_component/header_component.rb +5 -8
- data/app/helpers/govuk_components_helper.rb +1 -0
- data/lib/govuk/components/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 97cb13bbf94f21942d186a15574ab81753e4c14b26382775ab5dcc748043ce68
|
|
4
|
+
data.tar.gz: b10e0c6b31295930c300d84f51501fedb36de8e33bfb4de528bfd1ae237b5729
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b5077e7da99cd661503e8625735a2b13d322f772f2b83b65da20caf697ba24818b454d35a6dcd7ef48a4477e2d0710c7e3eeb976167a66f6acd4e75922504c5
|
|
7
|
+
data.tar.gz: d80c55dca5308bb77e4158274d47e93a5ce22fa98aef05441c314951232696304ce1ee083bf851e2abe1ee97c3b0edd67a18dfc2195fb512bacb64a76a9b4bf0
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://badge.fury.io/rb/govuk-components)
|
|
5
5
|
[](https://rubygems.org/gems/govuk-components)
|
|
6
6
|
[](https://github.com/x-govuk/govuk-components/blob/main/LICENSE.txt)
|
|
7
|
-
[](https://design-system.service.gov.uk)
|
|
8
8
|
[](https://viewcomponent.org/)
|
|
9
9
|
[](https://weblog.rubyonrails.org/releases/)
|
|
10
10
|
[](https://www.ruby-lang.org/en/downloads/)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%= tag.header(**header_html_attributes) do %>
|
|
2
|
+
<%= tag.div(class: "#{brand}-generic-header", **html_attributes) do %>
|
|
3
|
+
<%= tag.div(class: ["#{brand}-generic-header__container", "#{brand}-width-container"]) do %>
|
|
4
|
+
<%= tag.div(class: "#{brand}-generic-header__logo") do %>
|
|
5
|
+
<%=
|
|
6
|
+
case
|
|
7
|
+
when logo.present? then logo
|
|
8
|
+
when url.present? then link_to(logo_text, url, class: "#{brand}-generic-header__homepage-link")
|
|
9
|
+
else logo_text
|
|
10
|
+
end
|
|
11
|
+
%>
|
|
12
|
+
<% end %>
|
|
13
|
+
<%= content %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<%= service_navigation %>
|
|
17
|
+
<%= phase_banner %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class GovukComponent::GenericHeaderComponent < GovukComponent::Base
|
|
2
|
+
renders_one :logo
|
|
3
|
+
renders_one :service_navigation, "GovukComponent::ServiceNavigationComponent"
|
|
4
|
+
renders_one :phase_banner, "GovukComponent::PhaseBannerComponent"
|
|
5
|
+
|
|
6
|
+
attr_reader :url,
|
|
7
|
+
:logo_text,
|
|
8
|
+
:menu_button_label,
|
|
9
|
+
:header_html_attributes
|
|
10
|
+
|
|
11
|
+
def initialize(url: nil,
|
|
12
|
+
logo_text: nil,
|
|
13
|
+
classes: [],
|
|
14
|
+
html_attributes: {},
|
|
15
|
+
header_html_attributes: {})
|
|
16
|
+
|
|
17
|
+
@url = url
|
|
18
|
+
@logo_text = logo_text
|
|
19
|
+
@header_html_attributes = header_html_attributes
|
|
20
|
+
|
|
21
|
+
super(classes:, html_attributes:)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def before_render
|
|
25
|
+
if logo.blank?
|
|
26
|
+
fail(ArgumentError, 'logo_text missing') if logo_text.blank?
|
|
27
|
+
fail(ArgumentError, 'url missing') if url.blank?
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def default_attributes
|
|
34
|
+
{ class: class_names("#{brand}-generic-header") }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
<%= tag.header(**header_html_attributes) do %>
|
|
2
2
|
<%= tag.div(data: { module: "#{brand}-header" }, **html_attributes) do %>
|
|
3
3
|
<%= tag.div(**container_html_attributes) do %>
|
|
4
4
|
<div class="<%= brand %>-header__logo">
|
|
@@ -41,4 +41,4 @@
|
|
|
41
41
|
<% end %>
|
|
42
42
|
<%= service_navigation %>
|
|
43
43
|
<%= phase_banner %>
|
|
44
|
-
|
|
44
|
+
<% end %>
|
|
@@ -5,25 +5,22 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
|
|
|
5
5
|
renders_one :phase_banner, "GovukComponent::PhaseBannerComponent"
|
|
6
6
|
|
|
7
7
|
attr_reader :homepage_url,
|
|
8
|
-
:service_name,
|
|
9
8
|
:service_url,
|
|
10
|
-
:menu_button_label,
|
|
11
9
|
:custom_container_classes,
|
|
12
|
-
:full_width_border
|
|
10
|
+
:full_width_border,
|
|
11
|
+
:header_html_attributes
|
|
13
12
|
|
|
14
13
|
def initialize(classes: [],
|
|
15
14
|
html_attributes: {},
|
|
16
15
|
homepage_url: config.default_header_homepage_url,
|
|
17
|
-
menu_button_label: config.default_header_menu_button_label,
|
|
18
16
|
container_classes: nil,
|
|
19
|
-
full_width_border: false
|
|
17
|
+
full_width_border: false,
|
|
18
|
+
header_html_attributes: {})
|
|
20
19
|
|
|
21
20
|
@homepage_url = homepage_url
|
|
22
|
-
@service_name = service_name
|
|
23
|
-
@service_url = service_url
|
|
24
|
-
@menu_button_label = menu_button_label
|
|
25
21
|
@custom_container_classes = container_classes
|
|
26
22
|
@full_width_border = full_width_border
|
|
23
|
+
@header_html_attributes = header_html_attributes
|
|
27
24
|
|
|
28
25
|
super(classes:, html_attributes:)
|
|
29
26
|
end
|
|
@@ -7,6 +7,7 @@ module GovukComponentsHelper
|
|
|
7
7
|
govuk_details: 'GovukComponent::DetailsComponent',
|
|
8
8
|
govuk_exit_this_page: 'GovukComponent::ExitThisPageComponent',
|
|
9
9
|
govuk_footer: 'GovukComponent::FooterComponent',
|
|
10
|
+
govuk_generic_header: 'GovukComponent::GenericHeaderComponent',
|
|
10
11
|
govuk_header: 'GovukComponent::HeaderComponent',
|
|
11
12
|
govuk_inset_text: 'GovukComponent::InsetTextComponent',
|
|
12
13
|
govuk_notification_banner: 'GovukComponent::NotificationBannerComponent',
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk-components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- DfE developers
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: html-attributes-utils
|
|
@@ -360,6 +359,8 @@ files:
|
|
|
360
359
|
- app/components/govuk_component/exit_this_page_component.rb
|
|
361
360
|
- app/components/govuk_component/footer_component.html.erb
|
|
362
361
|
- app/components/govuk_component/footer_component.rb
|
|
362
|
+
- app/components/govuk_component/generic_header_component.html.erb
|
|
363
|
+
- app/components/govuk_component/generic_header_component.rb
|
|
363
364
|
- app/components/govuk_component/header_component.html.erb
|
|
364
365
|
- app/components/govuk_component/header_component.rb
|
|
365
366
|
- app/components/govuk_component/inset_text_component.rb
|
|
@@ -422,7 +423,6 @@ homepage: https://github.com/x-govuk/govuk-components
|
|
|
422
423
|
licenses:
|
|
423
424
|
- MIT
|
|
424
425
|
metadata: {}
|
|
425
|
-
post_install_message:
|
|
426
426
|
rdoc_options: []
|
|
427
427
|
require_paths:
|
|
428
428
|
- lib
|
|
@@ -430,15 +430,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
430
430
|
requirements:
|
|
431
431
|
- - ">="
|
|
432
432
|
- !ruby/object:Gem::Version
|
|
433
|
-
version: '
|
|
433
|
+
version: '3.3'
|
|
434
434
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
435
435
|
requirements:
|
|
436
436
|
- - ">="
|
|
437
437
|
- !ruby/object:Gem::Version
|
|
438
438
|
version: '0'
|
|
439
439
|
requirements: []
|
|
440
|
-
rubygems_version:
|
|
441
|
-
signing_key:
|
|
440
|
+
rubygems_version: 4.0.10
|
|
442
441
|
specification_version: 4
|
|
443
442
|
summary: GOV.UK Components for Ruby on Rails
|
|
444
443
|
test_files: []
|