This work amends the code from f2f6046c0f92ff1faed057da0711ac478eef439c
where multiple geometry widgets rendered `<script>` elements in the
admin with the same HTML `id`, resulting in invalid HTML and fragile
JavaScript selectors. Refs #25706.
This change uses the widget's textarea ID to generate a unique `id` for
each JSON options `<script>`, ensuring valid and robust markup.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Refactored GIS-related JavaScript initialization to eliminate inline
scripts from templates. Added support for specifying a base layer using
the new `base_layer_name` attribute on `BaseGeometryWidget`, allowing
custom map tile providers via user-defined JavaScript.
As a result, the `gis/openlayers-osm.html` template was removed.
Thanks Sarah Boyce for reviews.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
In the admin's filter_horizontal widget, optional action buttons like
"Choose all", "Remove all", etc. were changed from `<a>` to `<button>`
elements in #34619, but without specifying `type="button"`. As a result,
when pressing Enter while focused on a form input, these buttons could
be triggered and intercept form submission.
Explicitly set `type="button"` on these control buttons to prevent them
from acting as submit buttons.
Thanks Antoliny Lee for the quick triage and review.
Regression in 857b1048d53ebf5fc5581c110e85c212b81ca83a.
In the admin, when selecting related objects via the helpers defined in
`RelatedObjectLookups.js`, the `dismissRelatedLookupPopup` function was
attempting to access `window.relatedWindows`, which does not exist in
real execution, causing related lookup popups to remain open.
This change ensures that this code correctly accesses the module-local
`relatedWindows` by explicitly assigning it to `window.relatedWindows`.
Regression in 91bebf1adb43561b54bac18e76224759dc70acb3.
Thanks Matthias Kestenholz for the report, the fix ideas, and testing.
Co-authored-by: Matthias Kestenholz <mk@feinheit.ch>
The eslint configuration and the admin script compress.py have been
updated for ES6.
The unused fallback of globals.django in jquery.init.js was removed. It
is always included before jsi18n-mocks.test.js and it always sets the
global value.
Since 8b30360322d4de6687e17ab267a856db4e3c78a6, the admin documentation
is explicit that only modern evergreen browsers are supported. This
allows removing several long standing workarounds for IE and Opera older
versions.
Since 2013, Opera is based on the Chromium blink engine.
Two-digit years in the range of [00, 68] are in the current century,
while [69,99] are in the previous century, according to the Open Group
Specification.