mirror of
https://github.com/pretix/pretix.git
synced 2026-01-03 18:52:26 +00:00
Compare commits
1 Commits
a11y-fix-d
...
issue-5077
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c8d2049a7 |
@@ -378,6 +378,8 @@ class EventSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
|
||||
if prop.name not in meta_data:
|
||||
current_object.delete()
|
||||
|
||||
instance._prefetched_objects_cache.clear()
|
||||
|
||||
# Item Meta properties
|
||||
if item_meta_properties is not None:
|
||||
current = list(event.item_meta_properties.all())
|
||||
@@ -398,6 +400,8 @@ class EventSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
|
||||
if prop.name not in list(item_meta_properties.keys()):
|
||||
prop.delete()
|
||||
|
||||
instance._prefetched_objects_cache.clear()
|
||||
|
||||
# Seats
|
||||
if seat_category_mapping is not None or ('seating_plan' in validated_data and validated_data['seating_plan'] is None):
|
||||
current_mappings = {
|
||||
|
||||
@@ -65,8 +65,6 @@ def render_label(content, label_for=None, label_class=None, label_title='', labe
|
||||
elif not optional:
|
||||
opt += '<i class="label-required">{}</i>'.format(pgettext('form', 'required'))
|
||||
|
||||
opt += '<strong class="label-alert" role="alert"></strong>'
|
||||
|
||||
builder = '<{tag}{attrs}>{content}{opt}</{tag}>'
|
||||
return format_html(
|
||||
builder,
|
||||
|
||||
@@ -60,7 +60,6 @@ var form_handlers = function (el) {
|
||||
locale: $("body").attr("data-datetimelocale"),
|
||||
useCurrent: false,
|
||||
showClear: !$(this).prop("required"),
|
||||
keepInvalid: true,
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
@@ -83,8 +82,6 @@ var form_handlers = function (el) {
|
||||
Math.abs(+new Date(opts.minDate) - new Date()) < Math.abs(+new Date(opts.maxDate) - new Date())
|
||||
) ? opts.minDate : opts.maxDate;
|
||||
}
|
||||
var container = $(this).closest(".form-group");
|
||||
var alert = $('.label-alert', container);
|
||||
$(this).datetimepicker(opts).on("dp.hide", function() {
|
||||
// when min/max is used in datetimepicker, closing and re-opening the picker opens at the wrong date
|
||||
// therefore keep the current viewDate and re-set it after datetimepicker is done hiding
|
||||
@@ -93,32 +90,7 @@ var form_handlers = function (el) {
|
||||
window.setTimeout(function () {
|
||||
$dtp.viewDate(currentViewDate);
|
||||
}, 50);
|
||||
}).on('dp.error', function (e) {
|
||||
container.addClass("has-error");
|
||||
if (e.date) {
|
||||
if (e.date.isBefore(opts["minDate"])) {
|
||||
alert.text(gettext("The date you entered is too early."));
|
||||
} else if (e.date.isAfter(opts["maxDate"])) {
|
||||
alert.text(gettext("The date you entered is too late."));
|
||||
}
|
||||
} else {
|
||||
alert.text(gettext("We could not recognize the date you entered."));
|
||||
}
|
||||
var self = this;
|
||||
window.setTimeout(function () {
|
||||
self.focus();
|
||||
}, 50);
|
||||
}).on('dp.change', function (e) {
|
||||
container.removeClass("has-error");
|
||||
alert.text("");
|
||||
}).on('blur', function (e) {// dp.change does not trigger when changed to empty string - although documentation notes otherwise
|
||||
if (!this.value) {
|
||||
container.removeClass("has-error");
|
||||
alert.text("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if ($(this).parent().is('.splitdatetimerow')) {
|
||||
$(this).on("dp.change", function (ev) {
|
||||
var $timepicker = $(this).closest(".splitdatetimerow").find(".timepickerfield");
|
||||
|
||||
@@ -145,20 +145,15 @@ output {
|
||||
color: $brand-primary;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.label-required,
|
||||
.label-alert {
|
||||
display: inline;
|
||||
.label-required {
|
||||
color: $text-muted;
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 85%;
|
||||
color: $text-muted;
|
||||
}
|
||||
.has-error .label-required,
|
||||
.has-error .label-alert {
|
||||
color: inherit;
|
||||
}
|
||||
.label-required {
|
||||
.checkbox .label-required {
|
||||
display: inline;
|
||||
&:before {
|
||||
content: " (";
|
||||
}
|
||||
@@ -166,22 +161,6 @@ output {
|
||||
content: ")";
|
||||
}
|
||||
}
|
||||
.label-alert:not(:empty):before {
|
||||
content: " – ";
|
||||
}
|
||||
@media (min-width: $screen-md-min) {
|
||||
.form-group:not(:has(.checkbox)) {
|
||||
.label-required,
|
||||
.label-alert:not(:empty) {
|
||||
display: block;
|
||||
}
|
||||
.label-required:before,
|
||||
.label-required:after,
|
||||
.label-alert:before {
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-control-text {
|
||||
padding-top: 7px;
|
||||
|
||||
@@ -734,6 +734,9 @@ def test_event_update(token_client, organizer, event, item, meta_prop):
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.data["meta_data"] == {
|
||||
meta_prop.name: "Workshop"
|
||||
}
|
||||
with scopes_disabled():
|
||||
assert organizer.events.get(slug=resp.data['slug']).meta_values.filter(
|
||||
property__name=meta_prop.name, value="Workshop"
|
||||
|
||||
Reference in New Issue
Block a user