theatlantic / django-nested-admin

Django admin classes that allow for nested inlines
http://django-nested-admin.readthedocs.org/
Other
727 stars 101 forks source link

Inline heading problem #261

Closed adi- closed 4 months ago

adi- commented 4 months ago

Admin looks like:

Zrzut ekranu 2024-07-22 o 10 50 27

And the code:

Zrzut ekranu 2024-07-22 o 10 50 45
drikusroor commented 4 months ago

Hey @adi-, I noticed the same and submitted a PR that should fix this a week ago #259

adi- commented 4 months ago

Nice, waiting for official bug fix.

drikusroor commented 3 months ago

Until the bug fix gets released, you can fix it with JavaScript:

// Function to fix the headings for tabular inline forms
function fixHeadings() {
    // Find the h2 element
    const h2Elements = document.querySelectorAll('.tabular h2.inline-heading');

    for (const h2Element of h2Elements) {

        // Get the next sibling node (which should be the text node)
        const textNode = h2Element.nextSibling;

        // Check if the next sibling is a text node and contains non-whitespace content
        if (textNode && textNode.nodeType === Node.TEXT_NODE && textNode.textContent.trim()) {
            // Move the text content into the h2 element
            h2Element.textContent = textNode.textContent.trim();

            // Remove the original text node
            textNode.remove();
        }
    }
}

document.addEventListener("DOMContentLoaded", (event) => {
    fixHeadings();
});

Which brings me to you, @fdintino: Do you have an estimation for when this fix could be released? Is there anything I could do to help? 😄

UPDATE: Nevermind, I saw 4.1.1 had been released on pypi.org already without a release here on Github :-)