govuk_web_banners 1.5.1 → 1.7.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 +3 -3
- data/app/views/govuk_web_banners/_global_banner.html.erb +2 -2
- data/config/govuk_web_banners/global_banners.yml +8 -1
- data/config/govuk_web_banners/recruitment_banners.yml +10 -1
- data/lib/govuk_web_banners/global_banner.rb +2 -2
- data/lib/govuk_web_banners/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0bc512988ceb38ba76cf93cb40589f70414d354b9c995881622cfec614ed885
|
4
|
+
data.tar.gz: 95de6f9c7fd84ae4c057311a110ca70869c5ec3c3eeb71c17d7aa72b7f679942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab27e4600a4d43d91a3a1a418f15a4149ac46f1f9758b318b9d81505b60a4919adfa4b784e5cb962e1d18bb6df80eeaa080fcb449abc9cc004fbf92eb908c95e
|
7
|
+
data.tar.gz: a9a8877d663743d995602fe35b46a2cefd38a50dfc1a24bfb567ec410caf696f8be0188764de41fcb1363f88d5aafb42bce281069739b445c7464dfa4a9cdb4f
|
data/README.md
CHANGED
@@ -108,7 +108,7 @@ global_banners:
|
|
108
108
|
title: "Register to Vote"
|
109
109
|
title_href: /register-to-vote
|
110
110
|
text: "You must register to vote before the election"
|
111
|
-
|
111
|
+
always_visible: false
|
112
112
|
exclude_paths:
|
113
113
|
- /find-your-local-electoral-office
|
114
114
|
start_date: 2024/10/21
|
@@ -122,12 +122,12 @@ Each banner must include a `title`, `title_href`, `text`, and a valid `start_dat
|
|
122
122
|
> `start_date` is **mandatory** here (unlike in recruitment banners) because it's
|
123
123
|
> needed to create a banner_version to pass to the underlying component. This lets
|
124
124
|
> the component reset the cookie that records how many times a banner has been seen
|
125
|
-
> (by default banners are shown only three times, see the `
|
125
|
+
> (by default banners are shown only three times, see the `always_visible` option below.)
|
126
126
|
|
127
127
|
Optional keys are:
|
128
128
|
- `name` (an identifying name for this banner, not rendered
|
129
129
|
anywhere)
|
130
|
-
- `
|
130
|
+
- `always_visible` (defaults to false. If false, banner is hidden if the user
|
131
131
|
has consented to cookies and has seen this banner more than 3 times)
|
132
132
|
- `exclude_paths` an array of paths on which the banner should not be shown.
|
133
133
|
Note that the banner is never shown on the path it points to, this
|
@@ -2,9 +2,9 @@
|
|
2
2
|
<% if global_banners.any? %>
|
3
3
|
<%= render "govuk_publishing_components/components/global_banner", {
|
4
4
|
title: global_banners.first.title,
|
5
|
-
|
5
|
+
title_href: global_banners.first.title_href,
|
6
6
|
text: global_banners.first.text,
|
7
|
-
|
7
|
+
always_visible: global_banners.first.always_visible,
|
8
8
|
banner_version: global_banners.first.version,
|
9
9
|
} %>
|
10
10
|
<% end %>
|
@@ -1,2 +1,9 @@
|
|
1
1
|
# Check README.md for how to format this file
|
2
|
-
global_banners:
|
2
|
+
global_banners:
|
3
|
+
- name: Emergency Alerts
|
4
|
+
title: "Emergency Alerts"
|
5
|
+
title_href: /alerts
|
6
|
+
text: "Test on Sunday 7 September, 3pm"
|
7
|
+
always_visible: true
|
8
|
+
start_date: 2025/08/31
|
9
|
+
end_date: 2025/09/08
|
@@ -141,4 +141,13 @@ banners:
|
|
141
141
|
# government-frontend
|
142
142
|
- /hmrc-internal-manuals/compliance-handbook/ch11400
|
143
143
|
start_date: 2025/07/21
|
144
|
-
end_date: 2025/08/18
|
144
|
+
end_date: 2025/08/18
|
145
|
+
- name: HMRC banner - Unity Business Services 2025/08/08
|
146
|
+
suggestion_text: "Help improve GOV.UK"
|
147
|
+
suggestion_link_text: "Sign up to take part in user research (opens in a new tab)"
|
148
|
+
survey_url: https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_74GjifgnGv6GsMC?Source=BannerList_HMRC_Applying_For_HMRC
|
149
|
+
page_paths:
|
150
|
+
# frontend
|
151
|
+
- /government/organisations/hm-revenue-customs/about/recruitment
|
152
|
+
start_date: 2025/08/08
|
153
|
+
end_date: 2025/09/05
|
@@ -16,7 +16,7 @@ module GovukWebBanners
|
|
16
16
|
global_banners_data["global_banners"].map { |attributes| GlobalBanner.new(attributes:) }
|
17
17
|
end
|
18
18
|
|
19
|
-
attr_reader :name, :title, :title_href, :text, :start_date, :end_date, :show_arrows, :
|
19
|
+
attr_reader :name, :title, :title_href, :text, :start_date, :end_date, :show_arrows, :always_visible, :exclude_paths
|
20
20
|
|
21
21
|
def initialize(attributes:)
|
22
22
|
@name = attributes["name"]
|
@@ -28,7 +28,7 @@ module GovukWebBanners
|
|
28
28
|
@start_date = attributes["start_date"] ? ActiveSupport::TimeZone[GovukWebBanners::TIME_ZONE].parse(attributes["start_date"]) : nil
|
29
29
|
@end_date = attributes["end_date"] ? ActiveSupport::TimeZone[GovukWebBanners::TIME_ZONE].parse(attributes["end_date"]) : Time.now + 10.years
|
30
30
|
@show_arrows = attributes["show_arrows"] == "true"
|
31
|
-
@
|
31
|
+
@always_visible = attributes["always_visible"] == "true"
|
32
32
|
@exclude_paths = attributes["exclude_paths"] || []
|
33
33
|
@exclude_paths << title_href if title_href&.start_with?("/")
|
34
34
|
end
|