-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1463 from DFE-Digital/feature/161271-information-…
…banner Add an Information banner
- Loading branch information
Showing
9 changed files
with
103 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="govuk-notification-banner" id="information-banner" role="region" aria-labelledby="govuk-notification-banner-title" data-module="govuk-notification-banner"> | ||
<div class="govuk-notification-banner__header"> | ||
<h2 class="govuk-notification-banner__title" id="govuk-notification-banner-title"> | ||
Important | ||
</h2> | ||
</div> | ||
<div class="govuk-notification-banner__content"> | ||
<h3 class="govuk-notification-banner__heading"> | ||
<%= t("information_banner.title") %> | ||
</h3> | ||
<%= t("information_banner.body.html") %> | ||
</div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
en: | ||
information_banner: | ||
title: Scheduled maintenance, 5pm on 5 April | ||
body: | ||
html: | ||
<p class="govuk-body">We will carry out maintenance on Complete from 5pm to 6pm on Friday 5 April 2024.</p> | ||
<p class="govuk-body">Project changes will not be saved during the maintenance.</p> | ||
<p class="govuk-body">Make sure you save your changes before the work starts.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Information Banner | ||
|
||
We sometimes want to inform all users of something important, scheduled downtime | ||
for example. | ||
|
||
To do so we have an Information banner that can be enabled and is then shown | ||
across the application. | ||
|
||
To set the content of the banner: | ||
|
||
- locate the `config/locales/information_banner.yml` locale file | ||
- update the `title` | ||
- update the HTML used for the `body` | ||
- commit, merge and deploy this change | ||
|
||
Then: | ||
|
||
- set the `SHOW_INFORMATION_BANNER` environment variable to `true` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require "rails_helper" | ||
|
||
RSpec.feature "Users can see an information banner" do | ||
let(:user) { create(:user, :regional_delivery_officer) } | ||
|
||
before do | ||
sign_in_with_user(user) | ||
end | ||
|
||
context "with the environment variable present and set to true" do | ||
it "shows the banner on all pages" do | ||
ClimateControl.modify SHOW_INFORMATION_BANNER: "true" do | ||
visit in_progress_your_projects_path | ||
|
||
expect(page).to have_selector("#information-banner") | ||
|
||
visit all_in_progress_projects_path | ||
|
||
expect(page).to have_selector("#information-banner") | ||
end | ||
end | ||
|
||
it "shows the title and body" do | ||
ClimateControl.modify SHOW_INFORMATION_BANNER: "true" do | ||
visit in_progress_your_projects_path | ||
|
||
within("#information-banner") do | ||
expect(page).to have_content(I18n.t("information_banner.title")) | ||
expect(page.html).to include(I18n.t("information_banner.body.html")) | ||
end | ||
end | ||
end | ||
end | ||
|
||
context "with the environment variable present and set to false" do | ||
it "does not show the banner" do | ||
ClimateControl.modify SHOW_INFORMATION_BANNER: "false" do | ||
visit in_progress_your_projects_path | ||
|
||
expect(page).not_to have_selector("#information-banner") | ||
end | ||
end | ||
end | ||
|
||
context "without the environment variable set" do | ||
it "does not show the banner" do | ||
visit in_progress_your_projects_path | ||
|
||
expect(page).not_to have_selector("#information-banner") | ||
end | ||
end | ||
end |