1. Added _CookieConseentPartial.cshtml Partial View
2. Used _CookieConseentPartial partial view in _Layout View 3. Added Privacy View Controller and View
This commit is contained in:
parent
0296735cb9
commit
8110a95111
16
src/Web/WebMVC/Controllers/HomeController.cs
Normal file
16
src/Web/WebMVC/Controllers/HomeController.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebMVC.Controllers
|
||||||
|
{
|
||||||
|
public class HomeController : Controller
|
||||||
|
{
|
||||||
|
public IActionResult Privacy()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
src/Web/WebMVC/Views/Home/Privacy.cshtml
Normal file
6
src/Web/WebMVC/Views/Home/Privacy.cshtml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Privacy Policy";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"]</h2>
|
||||||
|
|
||||||
|
<p>Use this page to detail your site's privacy policy.</p>
|
41
src/Web/WebMVC/Views/Shared/_CookieConsentPartial.cshtml
Normal file
41
src/Web/WebMVC/Views/Shared/_CookieConsentPartial.cshtml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
@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>
|
||||||
|
}
|
@ -1,139 +1,141 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - Microsoft.eShopOnContainers.WebMVC</title>
|
<title>@ViewData["Title"] - Microsoft.eShopOnContainers.WebMVC</title>
|
||||||
|
|
||||||
<environment names="Development">
|
<environment names="Development">
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||||
<link rel="stylesheet" href="~/css/app.css" />
|
<link rel="stylesheet" href="~/css/app.css" />
|
||||||
<link rel="stylesheet" href="~/css/app.component.css" />
|
<link rel="stylesheet" href="~/css/app.component.css" />
|
||||||
<link rel="stylesheet" href="~/css/shared/components/header/header.css" />
|
<link rel="stylesheet" href="~/css/shared/components/header/header.css" />
|
||||||
<link rel="stylesheet" href="~/css/shared/components/identity/identity.css" />
|
<link rel="stylesheet" href="~/css/shared/components/identity/identity.css" />
|
||||||
<link rel="stylesheet" href="~/css/shared/components/pager/pager.css" />
|
<link rel="stylesheet" href="~/css/shared/components/pager/pager.css" />
|
||||||
<link rel="stylesheet" href="~/css/basket/basket.component.css" />
|
<link rel="stylesheet" href="~/css/basket/basket.component.css" />
|
||||||
<link rel="stylesheet" href="~/css/campaigns/campaigns.component.css" />
|
<link rel="stylesheet" href="~/css/campaigns/campaigns.component.css" />
|
||||||
<link rel="stylesheet" href="~/css/basket/basket-status/basket-status.component.css" />
|
<link rel="stylesheet" href="~/css/basket/basket-status/basket-status.component.css" />
|
||||||
<link rel="stylesheet" href="~/css/catalog/catalog.component.css" />
|
<link rel="stylesheet" href="~/css/catalog/catalog.component.css" />
|
||||||
<link rel="stylesheet" href="~/css/orders/orders.component.css" />
|
<link rel="stylesheet" href="~/css/orders/orders.component.css" />
|
||||||
<link rel="stylesheet" href="~/css/orders/orders-detail/orders-detail.component.css" />
|
<link rel="stylesheet" href="~/css/orders/orders-detail/orders-detail.component.css" />
|
||||||
<link rel="stylesheet" href="~/css/orders/orders-new/orders-new.component.css" />
|
<link rel="stylesheet" href="~/css/orders/orders-new/orders-new.component.css" />
|
||||||
<link rel="stylesheet" href="~/css/override.css" type="text/css" />
|
<link rel="stylesheet" href="~/css/override.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="~/css/site.min.css" type="text/css" />
|
<link rel="stylesheet" href="~/css/site.min.css" type="text/css" />
|
||||||
|
|
||||||
</environment>
|
</environment>
|
||||||
<environment names="Staging,Production">
|
<environment names="Staging,Production">
|
||||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
|
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||||
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||||
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||||
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||||
<link rel="stylesheet" href="~/css/override.css" type="text/css" />
|
<link rel="stylesheet" href="~/css/override.css" type="text/css" />
|
||||||
</environment>
|
</environment>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="navbar navbar-light navbar-static-top">
|
<header class="navbar navbar-light navbar-static-top">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<article class="row">
|
<article class="row">
|
||||||
|
|
||||||
<section class="col-lg-7 col-md-6 col-xs-12">
|
<section class="col-lg-7 col-md-6 col-xs-12">
|
||||||
<a class="navbar-brand" routerLink="catalog">
|
<a class="navbar-brand" routerLink="catalog">
|
||||||
<a asp-area="" asp-controller="Catalog" asp-action="Index">
|
<a asp-area="" asp-controller="Catalog" asp-action="Index">
|
||||||
<img src="~/images/brand.png" />
|
<img src="~/images/brand.png" />
|
||||||
</a>
|
</a>
|
||||||
</a>
|
</a>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@await Html.PartialAsync("_LoginPartial")
|
@await Html.PartialAsync("_LoginPartial")
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@RenderBody()
|
<partial name="_CookieConsentPartial" />
|
||||||
|
|
||||||
|
@RenderBody()
|
||||||
|
|
||||||
|
|
||||||
<footer class="esh-app-footer">
|
<footer class="esh-app-footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<article class="row">
|
<article class="row">
|
||||||
|
|
||||||
<section class="col-sm-6">
|
<section class="col-sm-6">
|
||||||
<img class="esh-app-footer-brand" src="~/images/brand_dark.png" />
|
<img class="esh-app-footer-brand" src="~/images/brand_dark.png" />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="col-sm-6">
|
<section class="col-sm-6">
|
||||||
<img class="esh-app-footer-text hidden-xs" src="~/images/main_footer_text.png" width="335" height="26" alt="footer text image" />
|
<img class="esh-app-footer-text hidden-xs" src="~/images/main_footer_text.png" width="335" height="26" alt="footer text image" />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<environment names="Development">
|
<environment names="Development">
|
||||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
</environment>
|
</environment>
|
||||||
<environment names="Staging,Production">
|
<environment names="Staging,Production">
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||||
asp-fallback-test="window.jQuery">
|
asp-fallback-test="window.jQuery">
|
||||||
</script>
|
</script>
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
||||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
|
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
|
||||||
</script>
|
</script>
|
||||||
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||||
</environment>
|
</environment>
|
||||||
|
|
||||||
@RenderSection("scripts", required: false)
|
@RenderSection("scripts", required: false)
|
||||||
|
|
||||||
|
|
||||||
@using Microsoft.AspNetCore.Authentication;
|
@using Microsoft.AspNetCore.Authentication;
|
||||||
@using Microsoft.Extensions.Options
|
@using Microsoft.Extensions.Options
|
||||||
@inject IOptions<AppSettings> settings
|
@inject IOptions<AppSettings> settings
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
if ('@User.Identity.IsAuthenticated' === 'True') {
|
if ('@User.Identity.IsAuthenticated' === 'True') {
|
||||||
var timerId;
|
var timerId;
|
||||||
|
|
||||||
let connection = stablishConnection();
|
let connection = stablishConnection();
|
||||||
|
|
||||||
connection.start().then(function () {
|
|
||||||
console.log('User Registered to Signalr Hub');
|
|
||||||
});
|
|
||||||
|
|
||||||
registerNotificationHandlers(connection);
|
connection.start().then(function () {
|
||||||
}
|
console.log('User Registered to Signalr Hub');
|
||||||
|
});
|
||||||
|
|
||||||
function stablishConnection() {
|
registerNotificationHandlers(connection);
|
||||||
let hubHttpConnection = new signalR.HttpConnection('@settings.Value.SignalrHubUrl/hub/notificationhub', {
|
}
|
||||||
transport: signalR.TransportType.LongPolling,
|
|
||||||
accessTokenFactory: () => {
|
|
||||||
return "Authorization", getToken();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return new signalR.HubConnection(hubHttpConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
function registerNotificationHandlers(connection) {
|
function stablishConnection() {
|
||||||
connection.on("UpdatedOrderState", (message) => {
|
let hubHttpConnection = new signalR.HttpConnection('@settings.Value.SignalrHubUrl/hub/notificationhub', {
|
||||||
toastr.success('Updated to status: ' + message.status, 'Order Id: ' + message.orderId);
|
transport: signalR.TransportType.LongPolling,
|
||||||
if (window.location.pathname.split("/").pop() === 'Order') {
|
accessTokenFactory: () => {
|
||||||
refreshOrderList();
|
return "Authorization", getToken();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
return new signalR.HubConnection(hubHttpConnection);
|
||||||
|
}
|
||||||
|
|
||||||
function getToken() {
|
function registerNotificationHandlers(connection) {
|
||||||
return '@Context.GetTokenAsync("access_token").Result';
|
connection.on("UpdatedOrderState", (message) => {
|
||||||
}
|
toastr.success('Updated to status: ' + message.status, 'Order Id: ' + message.orderId);
|
||||||
|
if (window.location.pathname.split("/").pop() === 'Order') {
|
||||||
|
refreshOrderList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function refreshOrderList() {
|
function getToken() {
|
||||||
clearTimeout(timerId);
|
return '@Context.GetTokenAsync("access_token").Result';
|
||||||
timerId = setTimeout(function () {
|
}
|
||||||
window.location.reload();
|
|
||||||
}, 1000);
|
function refreshOrderList() {
|
||||||
}
|
clearTimeout(timerId);
|
||||||
</script>
|
timerId = setTimeout(function () {
|
||||||
</body>
|
window.location.reload();
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user