-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We want to add a phase banner that will indicate to our users that this app is in Beta. The banner title is dynamic based on the environment we are in and both claims and placements can control the content of it.
- Loading branch information
1 parent
7a23257
commit 6bb16dd
Showing
8 changed files
with
100 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "page_banner"; |
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,22 @@ | ||
.app-phase-banner .govuk-tag { | ||
color: govuk-colour("white"); | ||
text-transform: uppercase; | ||
letter-spacing: 1px; | ||
font-weight: 700; | ||
} | ||
|
||
.app-phase-banner__env--development .govuk-tag { | ||
background: govuk-colour("dark-grey"); | ||
} | ||
|
||
.app-phase-banner__env--qa .govuk-tag { | ||
background-color: govuk-colour("orange"); | ||
} | ||
|
||
.app-phase-banner__env--staging .govuk-tag { | ||
background-color: govuk-colour("red"); | ||
} | ||
|
||
.app-phase-banner__env--beta .govuk-tag { | ||
background: govuk-colour("blue"); | ||
} |
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 @@ | ||
module HostingEnvironment | ||
def self.name(current_service) | ||
if Rails.env.production? | ||
I18n.t(".models.hosting_environment.#{current_service}.name") | ||
else | ||
Rails.env | ||
end | ||
end | ||
|
||
def self.banner_description(current_service) | ||
I18n.t(".models.hosting_environment.#{current_service}.banner.description") | ||
end | ||
end |
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,7 @@ | ||
en: | ||
models: | ||
hosting_environment: | ||
claims: | ||
name: beta | ||
banner: | ||
description: Make a complaint or give feedback |
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,7 @@ | ||
en: | ||
models: | ||
hosting_environment: | ||
placements: | ||
name: beta | ||
banner: | ||
description: Make a complaint or give feedback |
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,40 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe HostingEnvironment do | ||
describe ".name" do | ||
it "returns the name of the hosting environment" do | ||
current_service = "claims" | ||
expect(described_class.name(current_service)).to eq("test") | ||
end | ||
|
||
context "when environment is production" do | ||
it "returns the name of the hosting environment for claims" do | ||
allow(Rails.env).to receive(:production?).and_return(true) | ||
current_service = "claims" | ||
expect(described_class.name(current_service)).to eq("beta") | ||
end | ||
|
||
it "returns the name of the hosting environment for placements" do | ||
allow(Rails.env).to receive(:production?).and_return(true) | ||
current_service = "placements" | ||
expect(described_class.name(current_service)).to eq("beta") | ||
end | ||
end | ||
end | ||
|
||
describe ".banner_description" do | ||
it "returns the banner description of the hosting environment for claims" do | ||
current_service = "claims" | ||
expect(described_class.banner_description(current_service)).to eq( | ||
"Make a complaint or give feedback" | ||
) | ||
end | ||
|
||
it "returns the banner description of the hosting environment for placements" do | ||
current_service = "placements" | ||
expect(described_class.banner_description(current_service)).to eq( | ||
"Make a complaint or give feedback" | ||
) | ||
end | ||
end | ||
end |