diff --git a/docs/DEPLOYMENT_SETUP.md b/docs/DEPLOYMENT_SETUP.md index ffa33d004d..6fd821164e 100644 --- a/docs/DEPLOYMENT_SETUP.md +++ b/docs/DEPLOYMENT_SETUP.md @@ -130,6 +130,45 @@ The following env variables are set in Travis: #### Banners +These environment variables allow us to set notification banners in the +application without a full redeployment of the application. Note the hierarchy +of the banner content. + +In addition, you can change the color of the banner by adding a type encoding in +the environment variable string. The default banner type will be `info` if no encoding is +provided. + +The possible banner type prefixes are: `info:`, `warn:`, and `error:`. Other +prefixes will not work and the invalid prefixes will be shown in the banner +text. + +Examples: + +``` +SITE_BANNER_CONTENT=info:This is an info banner. You can also add links in the text like https://example.com. There is also a dismiss button to the right of the text. +``` + +![Info banner +example](https://user-images.githubusercontent.com/22133008/93852946-8a867780-fce5-11ea-929f-a0ce1c6796b9.png) + +``` +SITE_BANNER_CONTENT=warn:This is a warning banner. You can also add links in the text like https://example.com +``` + +![Warning banner example](https://user-images.githubusercontent.com/22133008/93852559-cec54800-fce4-11ea-9376-9b2802e8ac62.png) + +``` +SITE_BANNER_CONTENT=error:This is an error banner. You can also add links in the text like https://example.com +``` + +![Error banner example](https://user-images.githubusercontent.com/22133008/93852689-1055f300-fce5-11ea-956d-d5966cbe86d8.png) + +``` +SITE_BANNER_CONTENT=hello:This is an invalid banner type, and the full text will be shown. The default banner type of `info` will used. +``` + +![Invalid banner default example](https://user-images.githubusercontent.com/22133008/93853306-392ab800-fce6-11ea-9891-f752bdad236e.png) + | Variable | Description | | :----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `SITE_BANNER_CONTENT` | If set, displays a banner message on both private routes that `ADMIN_BANNER_CONTENT` covers **and** public form routes that `IS_GENERAL_MAINTENANCE` covers. Overrides all other banner environment variables | diff --git a/src/public/main.css b/src/public/main.css index d0ad4fefe1..bf28a358e8 100644 --- a/src/public/main.css +++ b/src/public/main.css @@ -18,6 +18,7 @@ @import './modules/core/css/admin-form-header.css'; @import './modules/core/css/sg-govt-banner.css'; @import './modules/core/css/landing.css'; +@import './modules/core/css/banner.css'; @import './modules/core/css/how-it-works.css'; @import './modules/forms/admin/css/pop-up-modal.css'; @import './modules/forms/admin/css/edit-form.css'; diff --git a/src/public/main.js b/src/public/main.js index d5fc80ce9a..1388055d79 100644 --- a/src/public/main.js +++ b/src/public/main.js @@ -192,7 +192,6 @@ require('./modules/forms/admin/directives/configure-form.client.directive.js') require('./modules/forms/admin/directives/configure-mobile.client.directive.js') require('./modules/forms/admin/directives/verify-secret-key.client.directive.js') require('./modules/forms/admin/directives/daterangepicker.client.directive.js') -require('./modules/forms/admin/directives/scroll-to-id.client.directive.js') require('./modules/forms/admin/directives/edit-captcha.client.directive.js') require('./modules/forms/admin/controllers/create-form-template-modal.client.controller.js') require('./modules/forms/admin/controllers/collaborator-modal.client.controller.js') diff --git a/src/public/modules/core/componentViews/banner.html b/src/public/modules/core/componentViews/banner.html index decb9e1a3b..09c2f8dfc4 100644 --- a/src/public/modules/core/componentViews/banner.html +++ b/src/public/modules/core/componentViews/banner.html @@ -1,8 +1,16 @@ -