Skip to content

Commit

Permalink
Merge pull request #59 from Lombiq/issue/LMBQ-168
Browse files Browse the repository at this point in the history
LMBQ-168: Fixing checkbox width
  • Loading branch information
DemeSzabolcs authored May 13, 2023
2 parents ac296fb + 96bebb4 commit 8d90a22
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions Lombiq.Privacy/Views/PrivacyConsentCheckboxPart.cshtml
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>

0 comments on commit 8d90a22

Please sign in to comment.