mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 04:58:42 +02:00
Refactor
This commit is contained in:
parent
8ed59d9bc8
commit
1ca7955015
3 changed files with 41 additions and 16 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 organization’s name) after a domain’s approval,
|
To update attributes (like an organization’s name) after a domain’s 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' %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue