From 9554e28de1125966118748a7794370b594c8167c Mon Sep 17 00:00:00 2001 From: Matthew Schranz Date: Wed, 25 Feb 2015 16:20:17 -0500 Subject: [PATCH] feat(app): Add NCI Warning Banner. - Warning banner is show if no cookie is present from previously pressing it or forced to be if 'showWarning' is present in the query string. Closes #380 --- app/index.html | 7 +++++++ app/scripts/core/core.controller.ts | 22 +++++++++++++++++++--- app/styles/app.less | 13 ++++++++++++- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/app/index.html b/app/index.html index ef9533c60..faa0e79f9 100755 --- a/app/index.html +++ b/app/index.html @@ -39,6 +39,13 @@ +
+

**WARNING**

+

You are accessing a U.S. Government web site which may contain information that must be protected under the U. S. Privacy Act or other sensitive information and is intended for Government authorized use only. Unauthorized attempts to upload information, change information, or use of this web site may result in disciplinary action, civil, and/or criminal penalties. Unauthorized users of this web site should have no expectation of privacy regarding any communications or data processed by this web site. Anyone accessing this web site expressly consents to monitoring of their actions and all communication or data transiting or stored on or related to this web site and is advised that if such monitoring reveals possible evidence of criminal activity, NIH may provide that evidence to law enforcement officials.

+ + Accept + +
A newer version of this software is available. Click here to refresh the page. diff --git a/app/scripts/core/core.controller.ts b/app/scripts/core/core.controller.ts index 123999940..ecbde6593 100644 --- a/app/scripts/core/core.controller.ts +++ b/app/scripts/core/core.controller.ts @@ -3,15 +3,27 @@ module ngApp.core.controllers { import INotifyService = ng.cgNotify.INotifyService; export interface ICoreController { + showWarning: boolean; } class CoreController implements ICoreController { + showWarning: boolean = false; /* @ngInject */ constructor(public $scope: ng.IScope, private $rootScope: ngApp.IRootScope, private CartService: ICartService, - private notify: INotifyService) { + private notify: INotifyService, + $location: ng.ILocationService, + private $cookies: ng.ICookiesService) { + + var showWarning = $location.search()["showWarning"]; + + if (showWarning) { + this.$rootScope.showWarning = true; + } else if (!$cookies["NCI-Warning"]) { + this.$rootScope.showWarning = true; + } $scope.$on("undo", (event, action) => { if (action === "added") { @@ -30,12 +42,16 @@ module ngApp.core.controllers { this.$rootScope.$broadcast("gdc-cancel-request"); }; + this.$rootScope.closeWarning = () => { + this.$rootScope.showWarning = false; + this.$cookies["NCI-Warning"] = true; + }; + } } angular - .module("core.controller", [ - ]) + .module("core.controller", ["ngCookies"]) .controller("CoreController", CoreController); } diff --git a/app/styles/app.less b/app/styles/app.less index 4cb35beff..31caa0e2c 100755 --- a/app/styles/app.less +++ b/app/styles/app.less @@ -51,6 +51,18 @@ body { padding-top: 20px; } +.nci-warning { + position: fixed; + top: 0; + z-index: 100000000; + + .warning-close-button { + position: absolute; + top: 5px; + right: 15px; + } +} + .xhrCounter{ position: fixed; z-index: 2000; @@ -60,7 +72,6 @@ body { width: 5rem; font-weight: 300; font-size: 5rem; - } .xhrCounter.ng-enter, .xhrCounter.ng-leave {