* add dashboard sort initializer and tests within packs folder * run dashboard sort initializer in base.jsx spinup and on InstantClick change * remove assets/javascripts' dashboard sort initialization and comment out original file * fully remove original dashboard sort initializer file * export both functions within initializeDashboardSort * refactor import of selectNavigation function within CategoryLinksMobile
22 lines
583 B
JavaScript
22 lines
583 B
JavaScript
function selectNavigation(select, urlPrefix) {
|
|
const trigger = document.getElementById(select);
|
|
if (trigger) {
|
|
trigger.addEventListener('change', (event) => {
|
|
let url = event.target.value;
|
|
if (urlPrefix) {
|
|
url = urlPrefix + url;
|
|
}
|
|
|
|
InstantClick.preload(url);
|
|
InstantClick.display(url);
|
|
});
|
|
}
|
|
}
|
|
|
|
function initializeDashboardSort() {
|
|
selectNavigation('dashboard_sort', '/dashboard?sort=');
|
|
selectNavigation('dashboard_author');
|
|
selectNavigation('mobile_nav_dashboard');
|
|
}
|
|
|
|
export { selectNavigation, initializeDashboardSort };
|