Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
feat(app): Add NCI Warning Banner.
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Matthew Schranz committed Feb 25, 2015
1 parent b2ab4d5 commit 9554e28
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
7 changes: 7 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
</head>

<body>
<div class="alert alert-danger m-margin-bottom-0 ng-cloak nci-warning" data-ng-if="showWarning">
<p>**WARNING**</p>
<p>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.</p>
<a data-ng-click="closeWarning()" class="warning-close-button">
Accept
</a>
</div>
<div class="alert alert-warning m-margin-bottom-0 ng-cloak" ng-if="config.apiIsMismatched">
<a onclick="window.location.reload()">
A newer version of this software is available. Click here to refresh the page. <i class="fa fa-lg fa-refresh"></i>
Expand Down
22 changes: 19 additions & 3 deletions app/scripts/core/core.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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);
}
13 changes: 12 additions & 1 deletion app/styles/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -60,7 +72,6 @@ body {
width: 5rem;
font-weight: 300;
font-size: 5rem;

}

.xhrCounter.ng-enter, .xhrCounter.ng-leave {
Expand Down

0 comments on commit 9554e28

Please sign in to comment.