update the cookie consent control.
This commit is contained in:
@ -117,16 +117,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ConsentBody" xml:space="preserve">
|
||||
<value>
|
||||
<div class="gdpr-consent-bar bg-light text-dark p-3 fixed-bottom">
|
||||
<div class="container-fluid d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
By clicking "Accept", you agree us to use cookies to ensure you get the best experience on our website.
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">Accept</button>
|
||||
</div>
|
||||
</div>
|
||||
</value>
|
||||
<data name="Apply" xml:space="preserve">
|
||||
<value>Apply</value>
|
||||
</data>
|
||||
<data name="ConsentDescription" xml:space="preserve">
|
||||
<value>By clicking "Accept", you agree us to use cookies to ensure you get the best experience on our website.</value>
|
||||
</data>
|
||||
<data name="Privacy" xml:space="preserve">
|
||||
<value>Privacy</value>
|
||||
</data>
|
||||
</root>
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
@ -147,4 +147,10 @@
|
||||
<data name="Site" xml:space="preserve">
|
||||
<value>Site</value>
|
||||
</data>
|
||||
<data name="DisplayCookieConsent.HelpText" xml:space="preserve">
|
||||
<value>Specify whether display the cookie consent bar.</value>
|
||||
</data>
|
||||
<data name="DisplayCookieConsent.Text" xml:space="preserve">
|
||||
<value>Display Cookie Consent?</value>
|
||||
</data>
|
||||
</root>
|
@ -26,7 +26,7 @@
|
||||
<div class="container">
|
||||
<div class="row px-4">
|
||||
<Pane Name="@PaneNames.Admin" />
|
||||
<CookieConsent />
|
||||
<CookieConsent Enabled="true" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4,25 +4,35 @@
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject IStringLocalizer<CookieConsent> Localizer
|
||||
|
||||
@if (showBanner)
|
||||
@if (Enabled && showBanner)
|
||||
{
|
||||
<form method="post" @formname="CookieConsentForm" @onsubmit="async () => await AcceptPolicy()" data-enhance>
|
||||
<input type="hidden" name="@Constants.RequestVerificationToken" value="@SiteState.AntiForgeryToken" />
|
||||
@if (ChildContent != null)
|
||||
{
|
||||
@ChildContent
|
||||
}
|
||||
else
|
||||
{
|
||||
@((MarkupString)Convert.ToString(Localizer["ConsentBody"]))
|
||||
}
|
||||
<div class="gdpr-consent-bar bg-light text-dark p-3 fixed-bottom">
|
||||
<div class="container-fluid d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
@((MarkupString)Convert.ToString(Localizer["ConsentDescription"]))
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-primary" type="submit">@((MarkupString)Convert.ToString(Localizer["Apply"]))</button>
|
||||
@if (ShowPrivacyLink)
|
||||
{
|
||||
<a class="btn btn-secondary ms-2" href="/privacy" target="_blank">@((MarkupString)Convert.ToString(Localizer["Privacy"]))</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
}
|
||||
@code {
|
||||
private bool showBanner;
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; } = null;
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool ShowPrivacyLink { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Pane Name="Top Full Width" />
|
||||
<Pane Name="Top Full Width" />
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@ -107,18 +107,19 @@
|
||||
{
|
||||
<Pane Name="Footer" />
|
||||
}
|
||||
<CookieConsent />
|
||||
</div>
|
||||
<CookieConsent Enabled="@_displayCookieConsent" />
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@code {
|
||||
public override string Name => "Default Theme";
|
||||
|
||||
public override string Panes => PaneNames.Default + ",Top Full Width,Top 100%,Left 50%,Right 50%,Left 33%,Center 33%,Right 33%,Left Outer 25%,Left Inner 25%,Right Inner 25%,Right Outer 25%,Left 25%,Center 50%,Right 25%,Left Sidebar 66%,Right Sidebar 33%,Left Sidebar 33%,Right Sidebar 66%,Bottom 100%,Bottom Full Width,Footer";
|
||||
public override string Panes => PaneNames.Default + ",Top Full Width,Top 100%,Left 50%,Right 50%,Left 33%,Center 33%,Right 33%,Left Outer 25%,Left Inner 25%,Right Inner 25%,Right Outer 25%,Left 25%,Center 50%,Right 25%,Left Sidebar 66%,Right Sidebar 33%,Left Sidebar 33%,Right Sidebar 66%,Bottom 100%,Bottom Full Width,Footer";
|
||||
|
||||
private bool _login = true;
|
||||
private bool _register = true;
|
||||
private bool _footer = false;
|
||||
private bool _displayCookieConsent = false;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
@ -128,6 +129,7 @@
|
||||
_login = bool.Parse(SettingService.GetSetting(settings, GetType().Namespace + ":Login", "true"));
|
||||
_register = bool.Parse(SettingService.GetSetting(settings, GetType().Namespace + ":Register", "true"));
|
||||
_footer = bool.Parse(SettingService.GetSetting(settings, GetType().Namespace + ":Footer", "false"));
|
||||
_displayCookieConsent = bool.Parse(SettingService.GetSetting(settings, GetType().Namespace + ":DisplayCookieConsent", "false"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -13,9 +13,9 @@
|
||||
<select id="scope" class="form-select" value="@_scope" @onchange="(e => ScopeChanged(e))">
|
||||
@if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
|
||||
{
|
||||
<option value="site">@Localizer["Site"]</option>
|
||||
<option value="site">@Localizer["Site"]</option>
|
||||
}
|
||||
<option value="page">@Localizer["Page"]</option>
|
||||
<option value="page">@Localizer["Page"]</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -49,6 +49,16 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-1 align-items-center">
|
||||
<Label Class="col-sm-3" For="displayCookieConsent" ResourceKey="DisplayCookieConsent" ResourceType="@resourceType" HelpText="Specify whether display the cookie consent bar.">Display Cookie Consent?</Label>
|
||||
<div class="col-sm-9">
|
||||
<select id="footer" class="form-select" @bind="@_displayCookieConsent">
|
||||
<option value="-"><@SharedLocalizer["Not Specified"]></option>
|
||||
<option value="true">@SharedLocalizer["Yes"]</option>
|
||||
<option value="false">@SharedLocalizer["No"]</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
@ -58,6 +68,7 @@
|
||||
private string _login = "-";
|
||||
private string _register = "-";
|
||||
private string _footer = "-";
|
||||
private string _displayCookieConsent = "-";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
@ -85,6 +96,7 @@
|
||||
_login = SettingService.GetSetting(settings, GetType().Namespace + ":Login", "true");
|
||||
_register = SettingService.GetSetting(settings, GetType().Namespace + ":Register", "true");
|
||||
_footer = SettingService.GetSetting(settings, GetType().Namespace + ":Footer", "false");
|
||||
_displayCookieConsent = SettingService.GetSetting(settings, GetType().Namespace + ":DisplayCookieConsent", "false");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -92,7 +104,8 @@
|
||||
settings = SettingService.MergeSettings(PageState.Site.Settings, settings);
|
||||
_login = SettingService.GetSetting(settings, GetType().Namespace + ":Login", "-");
|
||||
_register = SettingService.GetSetting(settings, GetType().Namespace + ":Register", "-");
|
||||
_footer = SettingService.GetSetting(settings, GetType().Namespace + ":Footer", "-");
|
||||
_footer = SettingService.GetSetting(settings, GetType().Namespace + ":Footer", "-");
|
||||
_displayCookieConsent = SettingService.GetSetting(settings, GetType().Namespace + ":DisplayCookieConsent", "-");
|
||||
}
|
||||
await Task.Yield();
|
||||
}
|
||||
@ -131,6 +144,11 @@
|
||||
{
|
||||
settings = SettingService.SetSetting(settings, GetType().Namespace + ":Footer", _footer);
|
||||
}
|
||||
if (_displayCookieConsent != "-")
|
||||
{
|
||||
settings = SettingService.SetSetting(settings, GetType().Namespace + ":DisplayCookieConsent", _displayCookieConsent);
|
||||
}
|
||||
|
||||
await SettingService.UpdateSiteSettingsAsync(settings, PageState.Site.SiteId);
|
||||
}
|
||||
else
|
||||
@ -148,6 +166,10 @@
|
||||
{
|
||||
settings = SettingService.SetSetting(settings, GetType().Namespace + ":Footer", _footer);
|
||||
}
|
||||
if (_displayCookieConsent != "-")
|
||||
{
|
||||
settings = SettingService.SetSetting(settings, GetType().Namespace + ":DisplayCookieConsent", _displayCookieConsent);
|
||||
}
|
||||
await SettingService.UpdatePageSettingsAsync(settings, pageId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user