mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 18:56:15 +02:00
Move back helpers into the watched folders
This commit is contained in:
parent
58db81c41d
commit
71e6e9240e
13 changed files with 45 additions and 38 deletions
|
@ -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';
|
import { handlePortfolioSelection } from './helpers-portfolio-dynamic-fields.js';
|
||||||
|
|
||||||
function displayModalOnDropdownClick(linkClickedDisplaysModal, statusDropdown, actionButton, valueToCheck){
|
function displayModalOnDropdownClick(linkClickedDisplaysModal, statusDropdown, actionButton, valueToCheck){
|
||||||
|
@ -113,7 +113,7 @@ export function initApprovedDomain() {
|
||||||
function updateFormGroupVisibility(showFormGroups) {
|
function updateFormGroupVisibility(showFormGroups) {
|
||||||
if (showFormGroups) {
|
if (showFormGroups) {
|
||||||
showElement(approvedDomainFormGroup);
|
showElement(approvedDomainFormGroup);
|
||||||
}else {
|
} else {
|
||||||
hideElement(approvedDomainFormGroup);
|
hideElement(approvedDomainFormGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,8 +436,8 @@ class CustomizableEmailBase {
|
||||||
this.modalConfirm.addEventListener("click", () => {
|
this.modalConfirm.addEventListener("click", () => {
|
||||||
this.textarea.removeAttribute('readonly');
|
this.textarea.removeAttribute('readonly');
|
||||||
this.textarea.focus();
|
this.textarea.focus();
|
||||||
hideElement(this.directEditButton);
|
hideElement(this.directEditButton);
|
||||||
hideElement(this.modalTrigger);
|
hideElement(this.modalTrigger);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,8 +445,8 @@ class CustomizableEmailBase {
|
||||||
this.directEditButton.addEventListener("click", () => {
|
this.directEditButton.addEventListener("click", () => {
|
||||||
this.textarea.removeAttribute('readonly');
|
this.textarea.removeAttribute('readonly');
|
||||||
this.textarea.focus();
|
this.textarea.focus();
|
||||||
hideElement(this.directEditButton);
|
hideElement(this.directEditButton);
|
||||||
hideElement(this.modalTrigger);
|
hideElement(this.modalTrigger);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,12 +473,12 @@ class CustomizableEmailBase {
|
||||||
showElement(this.textarea);
|
showElement(this.textarea);
|
||||||
hideElement(this.textareaPlaceholder);
|
hideElement(this.textareaPlaceholder);
|
||||||
|
|
||||||
if (this.isEmailAlreadySentConst) {
|
if (this.isEmailAlreadySentConst) {
|
||||||
hideElement(this.directEditButton);
|
hideElement(this.directEditButton);
|
||||||
showElement(this.modalTrigger);
|
showElement(this.modalTrigger);
|
||||||
} else {
|
} else {
|
||||||
showElement(this.directEditButton);
|
showElement(this.directEditButton);
|
||||||
hideElement(this.modalTrigger);
|
hideElement(this.modalTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isEmailAlreadySent()) {
|
if (this.isEmailAlreadySent()) {
|
||||||
|
@ -501,10 +501,10 @@ class CustomizableEmailBase {
|
||||||
showPlaceholder(formLabelText, placeholderText) {
|
showPlaceholder(formLabelText, placeholderText) {
|
||||||
this.formLabel.innerHTML = formLabelText;
|
this.formLabel.innerHTML = formLabelText;
|
||||||
this.textareaPlaceholder.innerHTML = placeholderText;
|
this.textareaPlaceholder.innerHTML = placeholderText;
|
||||||
showElement(this.textareaPlaceholder);
|
showElement(this.textareaPlaceholder);
|
||||||
hideElement(this.directEditButton);
|
hideElement(this.directEditButton);
|
||||||
hideElement(this.modalTrigger);
|
hideElement(this.modalTrigger);
|
||||||
hideElement(this.textarea);
|
hideElement(this.textarea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
17
src/registrar/assets/modules-admin/helpers-admin.js
Normal file
17
src/registrar/assets/modules-admin/helpers-admin.js
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.
|
* Helper function that handles business logic for the suborganization field.
|
||||||
|
|
|
@ -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
|
* A function for dynamically changing some fields on the portfolio admin model
|
||||||
|
|
|
@ -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) */
|
/** An IIFE for toggling the overflow styles on django-admin__model-description (the show more / show less button) */
|
||||||
export function initDescriptions() {
|
export function initDescriptions() {
|
||||||
|
@ -8,7 +8,8 @@ export function initDescriptions() {
|
||||||
// Hide the toggle button if text content is less than 200 characters
|
// 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
|
// This is a little over 160 characters to give us some wiggle room if we
|
||||||
// change the font size marginally.
|
// change the font size marginally.
|
||||||
hideElement(toggleButton);
|
if (toggleButton)
|
||||||
|
hideElement(toggleButton);
|
||||||
} else {
|
} else {
|
||||||
toggleButton.addEventListener('click', function() {
|
toggleButton.addEventListener('click', function() {
|
||||||
toggleShowMoreButton(toggleButton, descriptionDiv, 'dja__model-description--no-overflow');
|
toggleShowMoreButton(toggleButton, descriptionDiv, 'dja__model-description--no-overflow');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { hideElement, showElement } from '../modules-common/helpers.js';
|
import { hideElement, showElement } from './helpers.js';
|
||||||
|
|
||||||
export function loadInitialValuesForComboBoxes() {
|
export function loadInitialValuesForComboBoxes() {
|
||||||
var overrideDefaultClearButton = true;
|
var overrideDefaultClearButton = true;
|
||||||
|
|
|
@ -67,12 +67,3 @@ export function debounce(handler, cooldown=600) {
|
||||||
timeout = setTimeout(() => handler.apply(context, args), cooldown);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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.
|
/** A function that intializes the requesting entity page.
|
||||||
* This page has a radio button that dynamically toggles some fields
|
* This page has a radio button that dynamically toggles some fields
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { hideElement, showElement, toggleCaret } from '../modules-common/helpers.js';
|
import { hideElement, showElement, toggleCaret } from './helpers.js';
|
||||||
|
|
||||||
export class LoadTableBase {
|
export class LoadTableBase {
|
||||||
constructor(sectionSelector) {
|
constructor(sectionSelector) {
|
||||||
|
|
|
@ -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 { initializeModals, unloadModals } from './helpers-uswds.js';
|
||||||
import { getCsrfToken } from './helpers-csrf-token.js';
|
import { getCsrfToken } from './helpers-csrf-token.js';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { scrollToElement } from '../modules-common/helpers.js';
|
import { scrollToElement } from './helpers.js';
|
||||||
import { initializeTooltips } from './helpers-uswds.js';
|
import { initializeTooltips } from './helpers-uswds.js';
|
||||||
|
|
||||||
import { LoadTableBase } from './table-base.js';
|
import { LoadTableBase } from './table-base.js';
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import { hideElement, showElement, scrollToElement, toggleCaret } from '../modules-common/helpers.js';
|
import { scrollToElement } from './helpers.js';
|
||||||
import { initializeTooltips, initializeModals, unloadModals } from './helpers-uswds.js';
|
|
||||||
import { getCsrfToken } from './helpers-csrf-token.js';
|
|
||||||
|
|
||||||
import { LoadTableBase } from './table-base.js';
|
import { LoadTableBase } from './table-base.js';
|
||||||
|
|
||||||
|
|
|
@ -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';
|
import { LoadTableBase } from './table-base.js';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue