This commit is contained in:
zandercymatics 2024-04-26 09:53:43 -06:00
parent 8ed59d9bc8
commit 1ca7955015
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 41 additions and 16 deletions

View file

@ -558,21 +558,35 @@ function enableRelatedWidgetButtons(changeLink, deleteLink, viewLink, elementPk,
/** An IIFE for toggling the overflow styles on django-admin__model-description (the show more / show less button) */ /** An IIFE for toggling the overflow styles on django-admin__model-description (the show more / show less button) */
(function () { (function () {
let toggleButton = document.getElementById('dja-show-more-model-description'); function handleShowMoreButton(toggleButton, descriptionDiv){
let descriptionDiv = document.querySelector('.dja__model-description'); // Check the length of the text content in the description div
if (descriptionDiv.textContent.length < 200) {
if (toggleButton && descriptionDiv) { // Hide the toggle button if text content is less than 200 characters
// This is a little over 160 characters to give us some wiggle room if we
// change the font size marginally.
toggleButton.classList.add('display-none');
} else {
toggleButton.addEventListener('click', function() { toggleButton.addEventListener('click', function() {
toggleShowMoreButton(toggleButton, descriptionDiv, 'dja__model-description--no-overflow')
});
}
}
function toggleShowMoreButton(toggleButton, descriptionDiv, showMoreClassName){
// Toggle the class on the description div // Toggle the class on the description div
descriptionDiv.classList.toggle('dja__model-description--no-overflow'); descriptionDiv.classList.toggle(showMoreClassName);
// Change the button text based on the presence of the class // Change the button text based on the presence of the class
if (descriptionDiv.classList.contains('dja__model-description--no-overflow')) { if (descriptionDiv.classList.contains(showMoreClassName)) {
toggleButton.textContent = 'Show less'; toggleButton.textContent = 'Show less';
} else { } else {
toggleButton.textContent = 'Show more'; toggleButton.textContent = 'Show more';
} }
}); }
let toggleButton = document.getElementById('dja-show-more-model-description');
let descriptionDiv = document.querySelector('.dja__model-description');
if (toggleButton && descriptionDiv) {
handleShowMoreButton(toggleButton, descriptionDiv)
} }
})(); })();

View file

@ -625,11 +625,22 @@ div.dja__model-description{
overflow: hidden; overflow: hidden;
p, li { p, li {
color: var(--primary);
font-size: medium; font-size: medium;
line-height: 1.2em; line-height: 1.2em;
} }
@media (prefers-color-scheme: light) {
p, li {
color: var(--body-fg);
}
}
@media (prefers-color-scheme: dark) {
p, li {
color: var(--primary);
}
}
li { li {
list-style-type: disc; list-style-type: disc;
} }

View file

@ -9,7 +9,7 @@
<p> <p>
Once a domain request has been adjudicated, the details of that request should not be modified. Once a domain request has been adjudicated, the details of that request should not be modified.
To update attributes (like an organizations name) after a domains approval, To update attributes (like an organizations name) after a domains approval,
go to <a href="{% url 'admin:registrar_user_changelist' %}">Domains</a>. go to <a href="{% url 'admin:registrar_domain_changelist' %}">Domains</a>.
Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request. Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request.
</p> </p>
{% elif opts.model_name == 'domaininformation' %} {% elif opts.model_name == 'domaininformation' %}