Move back helpers into the watched folders

This commit is contained in:
Rachid Mrad 2024-11-19 19:57:27 -05:00
parent 58db81c41d
commit 71e6e9240e
No known key found for this signature in database
13 changed files with 45 additions and 38 deletions

View file

@ -1,4 +1,4 @@
import { hideElement, showElement, addOrRemoveSessionBoolean } from '../modules-common/helpers.js';
import { hideElement, showElement, addOrRemoveSessionBoolean } from './helpers-admin.js';
import { handlePortfolioSelection } from './helpers-portfolio-dynamic-fields.js';
function displayModalOnDropdownClick(linkClickedDisplaysModal, statusDropdown, actionButton, valueToCheck){
@ -113,7 +113,7 @@ export function initApprovedDomain() {
function updateFormGroupVisibility(showFormGroups) {
if (showFormGroups) {
showElement(approvedDomainFormGroup);
}else {
} else {
hideElement(approvedDomainFormGroup);
}
}
@ -436,8 +436,8 @@ class CustomizableEmailBase {
this.modalConfirm.addEventListener("click", () => {
this.textarea.removeAttribute('readonly');
this.textarea.focus();
hideElement(this.directEditButton);
hideElement(this.modalTrigger);
hideElement(this.directEditButton);
hideElement(this.modalTrigger);
});
}
@ -445,8 +445,8 @@ class CustomizableEmailBase {
this.directEditButton.addEventListener("click", () => {
this.textarea.removeAttribute('readonly');
this.textarea.focus();
hideElement(this.directEditButton);
hideElement(this.modalTrigger);
hideElement(this.directEditButton);
hideElement(this.modalTrigger);
});
}
@ -473,12 +473,12 @@ class CustomizableEmailBase {
showElement(this.textarea);
hideElement(this.textareaPlaceholder);
if (this.isEmailAlreadySentConst) {
hideElement(this.directEditButton);
showElement(this.modalTrigger);
} else {
showElement(this.directEditButton);
hideElement(this.modalTrigger);
if (this.isEmailAlreadySentConst) {
hideElement(this.directEditButton);
showElement(this.modalTrigger);
} else {
showElement(this.directEditButton);
hideElement(this.modalTrigger);
}
if (this.isEmailAlreadySent()) {
@ -501,10 +501,10 @@ class CustomizableEmailBase {
showPlaceholder(formLabelText, placeholderText) {
this.formLabel.innerHTML = formLabelText;
this.textareaPlaceholder.innerHTML = placeholderText;
showElement(this.textareaPlaceholder);
hideElement(this.directEditButton);
hideElement(this.modalTrigger);
hideElement(this.textarea);
showElement(this.textareaPlaceholder);
hideElement(this.directEditButton);
hideElement(this.modalTrigger);
hideElement(this.textarea);
}
}

View file

@ -0,0 +1,17 @@
export function hideElement(element) {
console.log(element)
element.classList.add('display-none');
};
export function showElement(element) {
element.classList.remove('display-none');
};
// Adds or removes a boolean from our session
export function addOrRemoveSessionBoolean(name, add){
if (add) {
sessionStorage.setItem(name, "true");
}else {
sessionStorage.removeItem(name);
}
}

View file

@ -1,4 +1,4 @@
import { hideElement, showElement } from '../modules-common/helpers.js';
import { hideElement, showElement } from './helpers-admin.js';
/**
* Helper function that handles business logic for the suborganization field.

View file

@ -1,4 +1,4 @@
import { hideElement, showElement } from '../modules-common/helpers.js';
import { hideElement, showElement } from './helpers-admin.js';
/**
* A function for dynamically changing some fields on the portfolio admin model

View file

@ -1,4 +1,4 @@
import { hideElement } from '../modules-common/helpers.js';
import { hideElement } from './helpers-admin.js';
/** An IIFE for toggling the overflow styles on django-admin__model-description (the show more / show less button) */
export function initDescriptions() {
@ -8,7 +8,8 @@ export function initDescriptions() {
// 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.
hideElement(toggleButton);
if (toggleButton)
hideElement(toggleButton);
} else {
toggleButton.addEventListener('click', function() {
toggleShowMoreButton(toggleButton, descriptionDiv, 'dja__model-description--no-overflow');

View file

@ -1,4 +1,4 @@
import { hideElement, showElement } from '../modules-common/helpers.js';
import { hideElement, showElement } from './helpers.js';
export function loadInitialValuesForComboBoxes() {
var overrideDefaultClearButton = true;

View file

@ -67,12 +67,3 @@ export function debounce(handler, cooldown=600) {
timeout = setTimeout(() => handler.apply(context, args), cooldown);
}
}
// Adds or removes a boolean from our session
export function addOrRemoveSessionBoolean(name, add){
if (add) {
sessionStorage.setItem(name, "true");
}else {
sessionStorage.removeItem(name);
}
}

View file

@ -1,4 +1,4 @@
import { hideElement, showElement } from '../modules-common/helpers.js';
import { hideElement, showElement } from './helpers.js';
/** A function that intializes the requesting entity page.
* This page has a radio button that dynamically toggles some fields

View file

@ -1,4 +1,4 @@
import { hideElement, showElement, toggleCaret } from '../modules-common/helpers.js';
import { hideElement, showElement, toggleCaret } from './helpers.js';
export class LoadTableBase {
constructor(sectionSelector) {

View file

@ -1,4 +1,4 @@
import { hideElement, showElement, scrollToElement } from '../modules-common/helpers.js';
import { hideElement, showElement, scrollToElement } from './helpers.js';
import { initializeModals, unloadModals } from './helpers-uswds.js';
import { getCsrfToken } from './helpers-csrf-token.js';

View file

@ -1,4 +1,4 @@
import { scrollToElement } from '../modules-common/helpers.js';
import { scrollToElement } from './helpers.js';
import { initializeTooltips } from './helpers-uswds.js';
import { LoadTableBase } from './table-base.js';

View file

@ -1,6 +1,4 @@
import { hideElement, showElement, scrollToElement, toggleCaret } from '../modules-common/helpers.js';
import { initializeTooltips, initializeModals, unloadModals } from './helpers-uswds.js';
import { getCsrfToken } from './helpers-csrf-token.js';
import { scrollToElement } from './helpers.js';
import { LoadTableBase } from './table-base.js';

View file

@ -1,4 +1,4 @@
import { hideElement, showElement, scrollToElement } from '../modules-common/helpers.js';
import { hideElement, showElement, scrollToElement } from './helpers.js';
import { LoadTableBase } from './table-base.js';