f1e4cca535
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
41 lines
No EOL
1.8 KiB
Text
Executable file
41 lines
No EOL
1.8 KiB
Text
Executable file
@using Microsoft.AspNetCore.Http.Features
|
|
|
|
@{
|
|
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
|
|
var showBanner = !consentFeature?.CanTrack ?? false;
|
|
var cookieString = consentFeature?.CreateConsentCookie();
|
|
}
|
|
|
|
@if (showBanner)
|
|
{
|
|
<nav id="cookieConsent" class="navbar navbar-default navbar-fixed-top" role="alert">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#cookieConsent .navbar-collapse">
|
|
<span class="sr-only">Toggle cookie consent banner</span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
</button>
|
|
<span class="navbar-brand"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></span>
|
|
</div>
|
|
<div class="collapse navbar-collapse">
|
|
<p class="navbar-text">
|
|
Use this space to summarize your privacy and cookie use policy.
|
|
</p>
|
|
<div class="navbar-right">
|
|
<a asp-controller="Home" asp-action="Privacy" class="btn btn-info navbar-btn">Learn More</a>
|
|
<button type="button" class="btn btn-default navbar-btn" data-cookie-string="@cookieString">Accept</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<script>
|
|
(function () {
|
|
document.querySelector("#cookieConsent button[data-cookie-string]").addEventListener("click", function (el) {
|
|
document.cookie = el.target.dataset.cookieString;
|
|
document.querySelector("#cookieConsent").classList.add("hidden");
|
|
}, false);
|
|
})();
|
|
</script>
|
|
} |