mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
#6372: Implement table-flush styling, improve changelog layout
This commit is contained in:
15
netbox/project-static/src/links.ts
Normal file
15
netbox/project-static/src/links.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { isTruthy, getElements } from './util';
|
||||
|
||||
/**
|
||||
* Allow any element to be made "clickable" with the use of the `data-href` attribute.
|
||||
*/
|
||||
export function initLinks() {
|
||||
for (const link of getElements('*[data-href]')) {
|
||||
const href = link.getAttribute('data-href');
|
||||
if (isTruthy(href)) {
|
||||
link.addEventListener('click', () => {
|
||||
window.location.assign(href);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user