2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 10:07:25 +00:00

Update to new Django admin styles for v3.x

This commit is contained in:
Philip Sargent
2022-03-03 14:18:51 +00:00
parent 7f41017ce3
commit dc4374cb9e
151 changed files with 19072 additions and 3638 deletions

View File

@@ -0,0 +1,16 @@
'use strict';
{
const inputTags = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
const modelName = document.getElementById('django-admin-form-add-constants').dataset.modelName;
if (modelName) {
const form = document.getElementById(modelName + '_form');
for (const element of form.elements) {
// HTMLElement.offsetParent returns null when the element is not
// rendered.
if (inputTags.includes(element.tagName) && !element.disabled && element.offsetParent) {
element.focus();
break;
}
}
}
}