Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LMBQ-168: Fixing checkbox width #59

Merged
merged 5 commits into from
May 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>