diff --git a/frontend/js/api.js b/frontend/js/api.js index 0489e19..a20f241 100644 --- a/frontend/js/api.js +++ b/frontend/js/api.js @@ -54,11 +54,19 @@ export const api = { }), // Content - getContent: (folderId, includeExpired = false) => { - const exp = includeExpired ? '&include_expired=1' : ''; - if (folderId === undefined) return request(`/content${exp ? '?' + exp.slice(1) : ''}`); - const q = folderId === null ? 'root' : encodeURIComponent(folderId); - return request(`/content?folder_id=${q}${exp}`); + getContent: (folderId, includeExpired = false, opts = {}) => { + const p = new URLSearchParams(); + // #214: a text search spans the whole workspace, so folder_id is only sent when + // NOT searching (the server also ignores folder_id when q is present, but keeping + // the client in sync avoids a misleading URL). + const searching = opts.q && opts.q.trim(); + if (!searching && folderId !== undefined) p.set('folder_id', folderId === null ? 'root' : folderId); + if (includeExpired) p.set('include_expired', '1'); + if (searching) p.set('q', opts.q.trim()); + if (opts.type && opts.type !== 'all') p.set('type', opts.type); + if (opts.sort) p.set('sort', opts.sort); + const qs = p.toString(); + return request(`/content${qs ? '?' + qs : ''}`); }, getContentItem: (id) => request(`/content/${id}`), deleteContent: (id) => request(`/content/${id}`, { method: 'DELETE' }), diff --git a/frontend/js/i18n/en.js b/frontend/js/i18n/en.js index 15ccb2e..f3091b5 100644 --- a/frontend/js/i18n/en.js +++ b/frontend/js/i18n/en.js @@ -186,6 +186,16 @@ export default { 'content.youtube_add_btn': 'Add YouTube Video', // Search / folders 'content.search_placeholder': 'Search content...', + 'content.filter_type_all': 'All types', + 'content.filter_type_video': 'Videos', + 'content.filter_type_image': 'Images', + 'content.filter_type_youtube': 'YouTube', + 'content.filter_type_web': 'Web / remote', + 'content.sort_newest': 'Newest first', + 'content.sort_oldest': 'Oldest first', + 'content.sort_name': 'Name A–Z', + 'content.sort_size': 'Largest first', + 'content.result_count': '{count} result(s)', 'content.new_folder_btn': '+ New Folder', 'content.breadcrumb_root': 'All Content', 'content.rename_btn': 'Rename', diff --git a/frontend/js/i18n/es.js b/frontend/js/i18n/es.js index 2b610c8..d251a68 100644 --- a/frontend/js/i18n/es.js +++ b/frontend/js/i18n/es.js @@ -149,6 +149,16 @@ export default { 'content.youtube_name_placeholder': 'Nombre para mostrar (opcional)', 'content.youtube_add_btn': 'Agregar video de YouTube', 'content.search_placeholder': 'Buscar contenido...', + 'content.filter_type_all': 'Todos los tipos', + 'content.filter_type_video': 'Videos', + 'content.filter_type_image': 'Imágenes', + 'content.filter_type_youtube': 'YouTube', + 'content.filter_type_web': 'Web / remoto', + 'content.sort_newest': 'Más recientes primero', + 'content.sort_oldest': 'Más antiguos primero', + 'content.sort_name': 'Nombre A–Z', + 'content.sort_size': 'Más grandes primero', + 'content.result_count': '{count} resultado(s)', 'content.new_folder_btn': '+ Nueva carpeta', 'content.breadcrumb_root': 'Todo el contenido', 'content.rename_btn': 'Renombrar', diff --git a/frontend/js/views/content-library.js b/frontend/js/views/content-library.js index 104283a..80cfcb3 100644 --- a/frontend/js/views/content-library.js +++ b/frontend/js/views/content-library.js @@ -96,7 +96,21 @@ export function render(container) {
- + + + +