feat(shared): show in classic view if an item is shared
This commit is contained in:
@@ -376,7 +376,7 @@ function initApp() {
|
||||
multiSelect.init();
|
||||
}
|
||||
|
||||
window.addEventListener('authenticationDone', () => {
|
||||
window.addEventListener('authenticationDone', async () => {
|
||||
// Check if a context was provided in the URL
|
||||
const hashContext = deserializeHash();
|
||||
switchSectionTo(hashContext.section);
|
||||
@@ -389,6 +389,7 @@ function initApp() {
|
||||
if (hashContext.file !== null) {
|
||||
app.viewFile = hashContext.file;
|
||||
}
|
||||
|
||||
loadFiles();
|
||||
}
|
||||
});
|
||||
@@ -604,6 +605,7 @@ function setupEventListeners() {
|
||||
let _updateHistory = true;
|
||||
|
||||
const itemI18nKey = item.querySelector('span').getAttribute('data-i18n');
|
||||
|
||||
switch (itemI18nKey) {
|
||||
case 'nav.shared':
|
||||
// Switch to shared view
|
||||
|
||||
@@ -190,10 +190,10 @@ function switchToSharedSection() {
|
||||
toggleFileContainer(false);
|
||||
|
||||
// Show shared view
|
||||
if (sharedView) {
|
||||
sharedView.init();
|
||||
sharedView.init().then(() => {
|
||||
sharedView.show();
|
||||
}
|
||||
});
|
||||
|
||||
if (multiSelect) multiSelect.clear();
|
||||
}
|
||||
|
||||
@@ -222,7 +222,10 @@ function switchToFilesSection() {
|
||||
ui.updateBreadcrumb();
|
||||
if (multiSelect) multiSelect.clear();
|
||||
|
||||
loadFiles();
|
||||
// temp solution
|
||||
sharedView.loadItems().then(() => {
|
||||
loadFiles();
|
||||
});
|
||||
}
|
||||
|
||||
function switchToFavoritesSection() {
|
||||
@@ -245,7 +248,10 @@ function switchToFavoritesSection() {
|
||||
ui.resetFilesList();
|
||||
|
||||
if (favorites) {
|
||||
favorites.displayFavorites();
|
||||
// temp solution
|
||||
sharedView.loadItems().then(() => {
|
||||
favorites.displayFavorites();
|
||||
});
|
||||
} else {
|
||||
console.error('Favorites module not loaded or initialized');
|
||||
ui.showError(`
|
||||
@@ -277,7 +283,9 @@ function switchToRecentFilesSection() {
|
||||
ui.resetFilesList();
|
||||
|
||||
if (recent) {
|
||||
recent.displayRecentFiles();
|
||||
sharedView.loadItems().then(() => {
|
||||
favorites.displayFavorites();
|
||||
});
|
||||
} else {
|
||||
console.error('Recent files module not loaded or initialized');
|
||||
ui.showError(`
|
||||
|
||||
+9
-3
@@ -16,6 +16,7 @@ import { wopiEditor } from '../features/files/wopiEditor.js';
|
||||
import { favorites } from '../features/library/favorites.js';
|
||||
import { recent } from '../features/library/recent.js';
|
||||
import { fileSharing } from '../features/sharing/fileSharing.js';
|
||||
import { sharedView } from '../views/shared/sharedView.js';
|
||||
import { loadFiles } from './filesView.js';
|
||||
import { updateHistory } from './main.js';
|
||||
import { syncViewContainers } from './navigation.js';
|
||||
@@ -1209,6 +1210,7 @@ const ui = {
|
||||
el.dataset.parentId = folder.parent_id || '';
|
||||
|
||||
const isFav = favorites?.isFavorite(folder.id, 'folder');
|
||||
const isShared = sharedView.isShared(folder.id, 'folder');
|
||||
const formattedDate = formatDateTime(folder.modified_at);
|
||||
|
||||
el.innerHTML = `
|
||||
@@ -1219,15 +1221,16 @@ const ui = {
|
||||
</div>
|
||||
<span>${escapeHtml(folder.name)}</span>
|
||||
${isFav ? '<i class="fas fa-star favorite-star-inline"></i>' : ''}
|
||||
${isShared ? '<div class="file-badge-shared"><i class="fas fa-share-alt"></i></div>' : ''}
|
||||
</div>
|
||||
<div class="type-cell">${i18n ? i18n.t('files.file_types.folder') : 'Folder'}</div>
|
||||
<div class="size-cell">--</div>
|
||||
<div class="date-cell">${formattedDate}</div>
|
||||
<div class="action-cell">
|
||||
<button class="favorite-star${isFav ? ' active' : ''}" data-item-id="${folder.id}" data-item-type="folder" data-item-name="${escapeHtml(folder.name)}">
|
||||
<button class="favorite-star${isFav ? ' active' : ''}" data-item-id="${folder.id}" data-item-type="folder" data-item-name="${escapeHtml(folder.name)}">
|
||||
<i class="${isFav ? 'fas' : 'far'} fa-star"></i>
|
||||
</button>
|
||||
<button class="file-actions"><i class="fas fa-ellipsis-v"></i></button>
|
||||
</button>
|
||||
<button class="file-actions"><i class="fas fa-ellipsis-v"></i></button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1247,6 +1250,7 @@ const ui = {
|
||||
const fileSize = file.size_formatted || formatFileSize(file.size);
|
||||
const formattedDate = formatDateTime(file.modified_at);
|
||||
const isFav = favorites?.isFavorite(file.id, 'file');
|
||||
const isShared = sharedView.isShared(file.id, 'file');
|
||||
|
||||
const el = document.createElement('div');
|
||||
el.className = 'file-item';
|
||||
@@ -1265,6 +1269,8 @@ const ui = {
|
||||
</div>
|
||||
<span>${escapeHtml(file.name)}</span>
|
||||
${isFav ? '<i class="fas fa-star favorite-star-inline"></i>' : ''}
|
||||
${isShared ? '<div class="file-badge-shared"><i class="fas fa-share-alt"></i></div>' : ''}
|
||||
|
||||
</div>
|
||||
<div class="type-cell">${typeLabel}</div>
|
||||
<div class="size-cell">${fileSize}</div>
|
||||
|
||||
Reference in New Issue
Block a user