Compare commits

..

1 Commits

Author SHA1 Message Date
Raphael Michel
1b11c58e0e Cookie consent: Proper fix for zero-provider situations 2025-05-22 16:46:20 +02:00
13 changed files with 45 additions and 47 deletions

View File

@@ -1,18 +0,0 @@
# Generated by Django 4.2.16 on 2025-05-20 11:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pretixbase", "0280_cartposition_max_extend"),
]
operations = [
migrations.AddField(
model_name="event",
name="is_remote",
field=models.BooleanField(default=False),
),
]

View File

@@ -616,11 +616,6 @@ class Event(EventMixin, LoggedModel):
max_length=200,
verbose_name=_("Location"),
)
is_remote = models.BooleanField(
default=False,
verbose_name=_("This event is remote or partially remote."),
help_text=_("This will be used to let users know if the event is in a different timezone and lets us calculate users local times."),
)
geo_lat = models.FloatField(
verbose_name=_("Latitude"),
null=True, blank=True,

View File

@@ -175,7 +175,6 @@ class EventWizardBasicsForm(I18nModelForm):
'presale_start',
'presale_end',
'location',
'is_remote',
'geo_lat',
'geo_lon',
]
@@ -449,7 +448,6 @@ class EventUpdateForm(I18nModelForm):
'presale_start',
'presale_end',
'location',
'is_remote',
'geo_lat',
'geo_lon',
'all_sales_channels',

View File

@@ -14,7 +14,7 @@
<input class="form-control" name="token" placeholder="{% trans "Token" %}" autocomplete="one-time-code"
type="text" required="required" autofocus="autofocus" id="webauthn-response">
</div>
<div class="alert alert-danger hidden" id="webauthn-error">
<div class="sr-only alert alert-danger" id="webauthn-error">
{% trans "WebAuthn failed. Check that the correct authentication device is correctly plugged in." %}
</div>
{% if jsondata %}

View File

@@ -61,7 +61,6 @@
{% bootstrap_field sform.locale layout="control" %}
{% bootstrap_field sform.timezone layout="control" %}
{% bootstrap_field sform.region layout="control" %}
{% bootstrap_field form.is_remote layout="control" %}
</fieldset>
<fieldset>
<legend>{% trans "Customer and attendee data" %}</legend>

View File

@@ -22,7 +22,7 @@
<button class="btn btn-primary sr-only" type="submit"></button>
</form>
<div class="alert alert-danger hidden" id="webauthn-error">
<div class="sr-only alert alert-danger" id="webauthn-error">
{% trans "Device registration failed." %}
</div>
<script type="text/json" id="webauthn-enroll">

View File

@@ -18,7 +18,7 @@
<input class="form-control" id="webauthn-response" name="webauthn"
type="hidden">
{% if jsondata %}
<div class="alert alert-danger hidden" id="webauthn-error">
<div class="sr-only alert alert-danger" id="webauthn-error">
{% trans "WebAuthn failed. Check that the correct authentication device is correctly plugged in." %}
</div>
<p><small>

View File

@@ -175,7 +175,7 @@
</div>
{% endif %}
{% if not cart_namespace or subevent %}
<div{% if request.event.is_remote%} class="event-is-remote"{% endif %}>
<div>
{% include "pretixpresale/event/fragment_event_info.html" with event=request.event subevent=subevent ev=ev show_location=True %}
</div>
{% eventsignal event "pretix.presale.signals.front_page_top" request=request subevent=subevent %}
@@ -242,6 +242,13 @@
</div>
{% endif %}
</form>
{% if ev.presale_is_running and display_add_to_cart %}
{% trans "You didn't select any ticket." as label_nothing_to_add %}
{% trans "Please tick a checkbox or enter a quantity for one of the ticket types to add to the cart." as description_nothing_to_add %}
{% dialog "dialog-nothing-to-add" label_nothing_to_add description_nothing_to_add icon="exclamation-circle" %}
<p class="modal-card-confirm"><button class="btn btn-primary">{% trans "OK" %}</button></p>
{% enddialog %}
{% endif %}
{% endif %}
{% endif %}
</main>

View File

@@ -123,9 +123,3 @@
{% endwith %}
{% endif %}
{% endif %}
{% trans "You didn't select any ticket." as label_nothing_to_add %}
{% trans "Please tick a checkbox or enter a quantity for one of the ticket types to add to the cart." as description_nothing_to_add %}
{% dialog "dialog-nothing-to-add" label_nothing_to_add description_nothing_to_add icon="exclamation-circle" %}
<p class="modal-card-confirm"><button class="btn btn-primary">{% trans "OK" %}</button></p>
{% enddialog %}

View File

@@ -50,7 +50,7 @@
{% for e in events %}{% eventurl e "presale:event.index" as url %}
<article class="row" aria-labelledby="event-{{ e.pk }}-label" aria-describedby="event-{{ e.pk }}-desc">
<h3 class="col-md-4 col-xs-12"><a href="{{ url }}" id="event-{{ e.pk }}-label" class="no-underline">{{ e.name }}</a></h3>
<p class="col-md-3 col-xs-12{% if e.is_remote%} event-is-remote{% endif %}" id="event-{{ e.pk }}-desc">
<p class="col-md-3 col-xs-12" id="event-{{ e.pk }}-desc">
{% if e.settings.show_dates_on_frontpage %}
{% if e.has_subevents %}
{% icon "calendar" %} {% trans "Multiple dates" context "subevent" %}

View File

@@ -145,7 +145,7 @@ const startRegister = async (e) => {
publicKey: publicKeyCredentialCreateOptions
});
} catch (err) {
$("#webauthn-error").removeClass("hidden");
$("#webauthn-error").removeClass("sr-only");
return console.error("Error creating credential:", err);
}
@@ -170,7 +170,7 @@ const startLogin = async (e) => {
publicKey: transformedCredentialRequestOptions,
});
} catch (err) {
$("#webauthn-error").removeClass("hidden");
$("#webauthn-error").removeClass("sr-only");
return console.error("Error when creating credential:", err);
}

View File

@@ -28,7 +28,7 @@ $(function () {
document.dispatchEvent(e)
}
if (!storage_key || !consent_modal) {
if (!storage_key) {
// We are not on a page where the consent should run, fire the change event with empty consent but don't
// actually store anything.
update_consent(null, false);
@@ -93,6 +93,11 @@ $(function () {
update_consent(storage_val, save_for_session_only);
if (!consent_modal) {
// Cookie consent is active, but no provider defined
return;
}
function _set_button_text () {
var btn = $("#cookie-consent-button-no");
btn.text(

View File

@@ -481,7 +481,7 @@ $(function () {
$("form:has(#btn-add-to-cart)").on("submit", function(e) {
if (
(this.classList.contains("has-seating") && this.querySelector("pretix-seating-checkout-button button")) ||
this.querySelector("input[type=checkbox]:checked, input[type=radio]:checked") ||
this.querySelector("input[type=checkbox]:checked") ||
[...this.querySelectorAll(".input-item-count:not([type=hidden])")].some(input => input.value && input.value !== "0") // TODO: seating adds a hidden seating-dummy-item-count, which is not useful and should at some point be removed
) {
// okay, let the submit-event bubble to async-task
@@ -572,17 +572,35 @@ $(function () {
form_handlers($("body"));
var local_tz = moment.tz.guess()
$(".event-is-remote span[data-timezone]").each(function() {
$("span[data-timezone], small[data-timezone], time[data-timezone]").each(function() {
var t = moment.tz($(this).attr("datetime") || $(this).attr("data-time"), $(this).attr("data-timezone"))
var tz = moment.tz.zone($(this).attr("data-timezone"))
var tpl = '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner text-nowrap"></div></div>';
$(this).tooltip({
"title": gettext("Time zone:") + " " + tz.abbr(t),
"template": tpl
});
if (t.tz(tz.name).format() !== t.tz(local_tz).format()) {
var format = t.tz(tz.name).format("YYYY-MM-DD") != t.tz(local_tz).format("YYYY-MM-DD") ? "datetimeformat" : "timeformat";
var time_str = t.tz(local_tz).format($("body").data(format));
var $add = $("<small>").addClass("text-muted").append(" (" + gettext("Your local time:") + " ")
$add.append($('<time>').attr("datetime", time_str).text(time_str))
$add.append(" " + moment.tz.zone(local_tz).abbr(t) + ")");
var $add = $("<span>")
$add.append(" ")
$add.append($("<span>").addClass("fa fa-globe"))
if ($(this).is("[data-time-short]")) {
$add.append($("<em>").text(" " + t.tz(local_tz).format($("body").attr("data-timeformat"))))
} else {
$add.addClass("text-muted")
$add.append(" " + gettext("Your local time:") + " ")
if (t.tz(tz.name).format("YYYY-MM-DD") != t.tz(local_tz).format("YYYY-MM-DD")) {
$add.append(t.tz(local_tz).format($("body").attr("data-datetimeformat")))
} else {
$add.append(t.tz(local_tz).format($("body").attr("data-timeformat")))
}
}
$add.insertAfter($(this));
$add.tooltip({
"title": gettext("Time zone:") + " " + moment.tz.zone(local_tz).abbr(t),
"template": tpl
});
}
});