-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from Lombiq/issue/LMBQ-168
LMBQ-168: Fixing checkbox width
- Loading branch information
Showing
1 changed file
with
26 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
@model PrivacyConsentCheckboxPartViewModel | ||
@using Microsoft.AspNetCore.Http.Features | ||
@using Lombiq.Privacy.Controllers | ||
|
||
@{ | ||
const string checkboxId = "PrivacyConsentCheckboxPart_ConsentCheckbox"; | ||
|
||
var consentFeature = Context.Features.Get<ITrackingConsentFeature>(); | ||
var acceptCookie = consentFeature?.CreateConsentCookie(); | ||
} | ||
|
||
<fieldset class="form-group" asp-validation-class-for="ConsentCheckbox"> | ||
<div class="col-md-9"> | ||
<div class="form-check"> | ||
<input asp-for="ConsentCheckbox" class="form-check-input" required /> | ||
<label asp-for="ConsentCheckbox" /> | ||
<shape Type="Lombiq_Privacy_ConsentCheckbox_Text" /> | ||
<br> | ||
<span asp-validation-for="ConsentCheckbox" class="text-danger"></span> | ||
</div> | ||
<div class="form-check"> | ||
<input asp-for="ConsentCheckbox" class="form-check-input" required data-cookie-string="@acceptCookie" /> | ||
<label asp-for="ConsentCheckbox" /> | ||
<shape Type="Lombiq_Privacy_ConsentCheckbox_Text" /> | ||
<br> | ||
<span asp-validation-for="ConsentCheckbox" class="text-danger"></span> | ||
</div> | ||
</fieldset> | ||
|
||
<script depends-on="jQuery" at="Foot"> | ||
$(function () { | ||
$('form').on('submit', function () { | ||
const $checkbox = $('#@checkboxId'); | ||
if ($checkbox.is(':checked')) { | ||
document.cookie = $checkbox.data('cookie-string'); | ||
} | ||
}); | ||
}); | ||
</script> |