mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Refs #35189 -- Removed no longer necessary JavaScript file collapse.js.
This commit is contained in:
parent
676060d683
commit
7857507c7f
@ -1,43 +0,0 @@
|
|||||||
/*global gettext*/
|
|
||||||
'use strict';
|
|
||||||
{
|
|
||||||
window.addEventListener('load', function() {
|
|
||||||
// Add anchor tag for Show/Hide link
|
|
||||||
const fieldsets = document.querySelectorAll('fieldset.collapse');
|
|
||||||
for (const [i, elem] of fieldsets.entries()) {
|
|
||||||
// Don't hide if fields in this fieldset have errors
|
|
||||||
if (elem.querySelectorAll('div.errors, ul.errorlist').length === 0) {
|
|
||||||
elem.classList.add('collapsed');
|
|
||||||
const h2 = elem.querySelector('h2');
|
|
||||||
const link = document.createElement('a');
|
|
||||||
link.id = 'fieldsetcollapser' + i;
|
|
||||||
link.className = 'collapse-toggle';
|
|
||||||
link.href = '#';
|
|
||||||
link.textContent = gettext('Show');
|
|
||||||
h2.appendChild(document.createTextNode(' ('));
|
|
||||||
h2.appendChild(link);
|
|
||||||
h2.appendChild(document.createTextNode(')'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add toggle to hide/show anchor tag
|
|
||||||
const toggleFunc = function(ev) {
|
|
||||||
if (ev.target.matches('.collapse-toggle')) {
|
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
const fieldset = ev.target.closest('fieldset');
|
|
||||||
if (fieldset.classList.contains('collapsed')) {
|
|
||||||
// Show
|
|
||||||
ev.target.textContent = gettext('Hide');
|
|
||||||
fieldset.classList.remove('collapsed');
|
|
||||||
} else {
|
|
||||||
// Hide
|
|
||||||
ev.target.textContent = gettext('Show');
|
|
||||||
fieldset.classList.add('collapsed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
document.querySelectorAll('fieldset.module').forEach(function(el) {
|
|
||||||
el.addEventListener('click', toggleFunc);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
@ -425,6 +425,9 @@ Miscellaneous
|
|||||||
when the fieldset has a name and use the ``collapse`` class, now includes
|
when the fieldset has a name and use the ``collapse`` class, now includes
|
||||||
``<details>`` and ``<summary>`` elements.
|
``<details>`` and ``<summary>`` elements.
|
||||||
|
|
||||||
|
* The JavaScript file ``collapse.js`` is removed since it is no longer needed
|
||||||
|
in the Django admin site.
|
||||||
|
|
||||||
* :meth:`.SimpleTestCase.assertURLEqual` and
|
* :meth:`.SimpleTestCase.assertURLEqual` and
|
||||||
:meth:`~django.test.SimpleTestCase.assertInHTML` now add ``": "`` to the
|
:meth:`~django.test.SimpleTestCase.assertInHTML` now add ``": "`` to the
|
||||||
``msg_prefix``. This is consistent with the behavior of other assertions.
|
``msg_prefix``. This is consistent with the behavior of other assertions.
|
||||||
|
@ -143,7 +143,6 @@
|
|||||||
<script src='./admin/inlines.test.js'></script>
|
<script src='./admin/inlines.test.js'></script>
|
||||||
|
|
||||||
<script src='../django/contrib/admin/static/admin/js/actions.js' data-cover></script>
|
<script src='../django/contrib/admin/static/admin/js/actions.js' data-cover></script>
|
||||||
<script src='../django/contrib/admin/static/admin/js/collapse.js' data-cover></script>
|
|
||||||
<script src='../django/contrib/admin/static/admin/js/prepopulate.js' data-cover></script>
|
<script src='../django/contrib/admin/static/admin/js/prepopulate.js' data-cover></script>
|
||||||
<script src='../django/contrib/admin/static/admin/js/urlify.js' data-cover></script>
|
<script src='../django/contrib/admin/static/admin/js/urlify.js' data-cover></script>
|
||||||
<script src='./admin/URLify.test.js'></script>
|
<script src='./admin/URLify.test.js'></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user