1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Remove obsolete TS for a.formaction

This commit is contained in:
jeremystretch
2021-09-27 11:41:05 -04:00
parent 68b1234388
commit d87d860a57
4 changed files with 10 additions and 45 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,28 +0,0 @@
import { getElements, findFirstAdjacent, isTruthy } from '../util';
/**
* Handle bulk add/edit/rename form actions.
*
* @param event Click Event
*/
function handleFormActionClick(event: Event): void {
event.preventDefault();
const element = event.currentTarget as HTMLElement;
if (element !== null) {
const form = findFirstAdjacent<HTMLFormElement>(element, 'form');
const href = element.getAttribute('href');
if (form !== null && isTruthy(href)) {
form.setAttribute('action', href);
form.submit();
}
}
}
/**
* Initialize bulk form action links.
*/
export function initFormActions(): void {
for (const element of getElements<HTMLAnchorElement>('a.formaction')) {
element.addEventListener('click', handleFormActionClick);
}
}

View File

@ -1,17 +1,10 @@
import { initFormActions } from './actions';
import { initFormElements } from './elements';
import { initSpeedSelector } from './speedSelector';
import { initScopeSelector } from './scopeSelector';
import { initVlanTags } from './vlanTags';
export function initForms(): void {
for (const func of [
initFormActions,
initFormElements,
initSpeedSelector,
initScopeSelector,
initVlanTags,
]) {
for (const func of [initFormElements, initSpeedSelector, initScopeSelector, initVlanTags]) {
func();
}
}