diff --git a/static/js/app/main.js b/static/js/app/main.js index 196575c9..8427b411 100644 --- a/static/js/app/main.js +++ b/static/js/app/main.js @@ -283,31 +283,31 @@ function switchSectionTo(section) { switch (section) { case "files": - switchToFilesView(); + switchToFilesSection(); case "shared": - switchToSharedView(); + switchToSharedSection(); break; case "recent": - switchToRecentFilesView(); + switchToRecentFilesSection(); break; case "favorites": - switchToFavoritesView(); + switchToFavoritesSection(); break; case "photos": - switchToPhotosView(); + switchToPhotosSection(); break; case "trash": - switchToTrashView(); + switchToTrashSection(); break; default: console.warn(`context view ${section} unkonwn fallback to drive section`); - switchToFilesView(); + switchToFilesSection(); } } @@ -586,30 +586,30 @@ function setupEventListeners() { switch(itemI18nKey) { case 'nav.shared': // Switch to shared view - switchToSharedView(); + switchToSharedSection(); break; case 'nav.favorites': // Switch to favorites view - switchToFavoritesView(); + switchToFavoritesSection(); break; case 'nav.recent': // Switch to recent files view - switchToRecentFilesView(); + switchToRecentFilesSection(); break; case 'nav.photos': - switchToPhotosView(); + switchToPhotosSection(); break; case 'nav.trash': - switchToTrashView(); + switchToTrashSection(); break; default: // Use the proper switchToFilesView function which handles all UI restoration - window.switchToFilesView(); + window.switchToFilesSection(); // FIXME: because fileview handles it: need to converge code _updateHistory = false; } diff --git a/static/js/app/navigation.js b/static/js/app/navigation.js index 9522f8c3..dca8e261 100644 --- a/static/js/app/navigation.js +++ b/static/js/app/navigation.js @@ -156,7 +156,7 @@ function setCurrentSection(section) { return true; } -function switchToSharedView() { +function switchToSharedSection() { if (!setCurrentSection('shared')) return; @@ -181,7 +181,7 @@ function switchToSharedView() { } } -function switchToFilesView() { +function switchToFilesSection() { if (!setCurrentSection('files')) return; // Set actions bar mode @@ -206,7 +206,7 @@ function switchToFilesView() { window.loadFiles(); } -function switchToFavoritesView() { +function switchToFavoritesSection() { if (!setCurrentSection('favorites')) return; // Set actions bar mode @@ -239,7 +239,7 @@ function switchToFavoritesView() { } } -function switchToRecentFilesView() { +function switchToRecentFilesSection() { if (!setCurrentSection('recent')) return; // Set actions bar mode @@ -272,7 +272,7 @@ function switchToRecentFilesView() { } } -function switchToPhotosView() { +function switchToPhotosSection() { if (!setCurrentSection('photos')) return; // Hide breadcrumb @@ -294,7 +294,7 @@ function switchToPhotosView() { } } -function switchToTrashView() { +function switchToTrashSection() { setCurrentSection('trash'); // Hide breadcrumb (only shown in Files view) @@ -311,11 +311,13 @@ function switchToTrashView() { // Load trash items window.loadTrashItems(); + + if (window.multiSelect) window.multiSelect.clear(); } -window.switchToFilesView = switchToFilesView; -window.switchToSharedView = switchToSharedView; -window.switchToFavoritesView = switchToFavoritesView; -window.switchToRecentFilesView = switchToRecentFilesView; -window.switchToPhotosView = switchToPhotosView; -window.switchToTrashView = switchToTrashView; +window.switchToFilesSection = switchToFilesSection; +window.switchToSharedSection = switchToSharedSection; +window.switchToFavoritesSection = switchToFavoritesSection; +window.switchToRecentFilesSection = switchToRecentFilesSection; +window.switchToPhotosSection = switchToPhotosSection; +window.switchToTrashSection = switchToTrashSection; diff --git a/static/js/features/sharing/fileSharing.js b/static/js/features/sharing/fileSharing.js index e95b89d9..420e5da9 100644 --- a/static/js/features/sharing/fileSharing.js +++ b/static/js/features/sharing/fileSharing.js @@ -188,8 +188,8 @@ const fileSharing = { const span = item.querySelector('span'); if (span && span.getAttribute('data-i18n') === 'nav.shared') { item.addEventListener('click', () => { - if (window.switchToSharedView) { - window.switchToSharedView(); + if (window.switchToSharedSection) { + window.switchToSharedSection(); } }); } diff --git a/static/js/views/shared/sharedView.js b/static/js/views/shared/sharedView.js index 0cfa5b49..cc186dfa 100644 --- a/static/js/views/shared/sharedView.js +++ b/static/js/views/shared/sharedView.js @@ -243,7 +243,7 @@ const sharedView = { const goToFilesBtn = document.getElementById('go-to-files-btn'); if (goToFilesBtn) { goToFilesBtn.addEventListener('click', () => { - if (window.switchToFilesView) window.switchToFilesView(); + if (window.switchToFilesSection) window.switchToFilesSection(); }); } },