Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Tag/Folder edit modals: show a dot on tabs that contain custom settings
Murtaza Nasirbb149519eb8c
diff --git a/static/locales/de.json b/static/locales/de.jsonindex 2ca50b5d..9fe6ae3a 100644--- a/static/locales/de.json+++ b/static/locales/de.json@@ -559,6 +559,7 @@"colorDescription": "Wählen Sie eine Farbe zur einfachen Identifikation","createTitle": "Tag Erstellen","editTitle": "Tag Bearbeiten",+ "tabHasSettings": "Hat benutzerdefinierte Einstellungen","updateTag": "Tag Aktualisieren","customPrompt": "Benutzerdefinierter Zusammenfassungs-Prompt","customPromptPlaceholder": "Optional: Benutzerdefinierter Prompt für die Generierung von Zusammenfassungen für Aufnahmen mit diesem Tag",diff --git a/static/locales/en.json b/static/locales/en.jsonindex 4bfd2201..645e9d8f 100644--- a/static/locales/en.json+++ b/static/locales/en.json@@ -559,6 +559,7 @@"colorDescription": "Choose a color for easy identification","createTitle": "Create Tag","editTitle": "Edit Tag",+ "tabHasSettings": "Has custom settings","updateTag": "Update Tag","customPrompt": "Custom Summary Prompt","customPromptPlaceholder": "Optional: Custom prompt for generating summaries for recordings with this tag",diff --git a/static/locales/es.json b/static/locales/es.jsonindex 5b4d8634..d5b067fa 100644--- a/static/locales/es.json+++ b/static/locales/es.json@@ -559,6 +559,7 @@"colorDescription": "Elige un color para fácil identificación","createTitle": "Crear Etiqueta","editTitle": "Editar Etiqueta",+ "tabHasSettings": "Tiene ajustes personalizados","updateTag": "Actualizar Etiqueta","customPrompt": "Prompt de Resumen Personalizado","customPromptPlaceholder": "Opcional: Prompt personalizado para generar resúmenes de grabaciones con esta etiqueta",diff --git a/static/locales/fr.json b/static/locales/fr.jsonindex c2431679..39e7bfd4 100644--- a/static/locales/fr.json+++ b/static/locales/fr.json@@ -559,6 +559,7 @@"colorDescription": "Choisissez une couleur pour faciliter l'identification","createTitle": "Créer une Étiquette","editTitle": "Modifier l'Étiquette",+ "tabHasSettings": "Contient des réglages personnalisés","updateTag": "Mettre à Jour l'Étiquette","customPrompt": "Invite de Résumé Personnalisée","customPromptPlaceholder": "Optionnel : Invite personnalisée pour générer des résumés pour les enregistrements avec cette étiquette",diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.jsonindex bf3b4005..226437f6 100644--- a/static/locales/pt-BR.json+++ b/static/locales/pt-BR.json@@ -559,6 +559,7 @@"colorDescription": "Escolha uma cor para identificação fácil","createTitle": "Criar Etiqueta","editTitle": "Editar Etiqueta",+ "tabHasSettings": "Tem configurações personalizadas","updateTag": "Atualizar Etiqueta","customPrompt": "Instrução de Resumo Personalizado","customPromptPlaceholder": "Opcional: Instrução personalizada para gerar resumos para gravações com esta etiqueta",diff --git a/static/locales/ru.json b/static/locales/ru.jsonindex 0a56daf7..6977a70f 100644--- a/static/locales/ru.json+++ b/static/locales/ru.json@@ -559,6 +559,7 @@"colorDescription": "Выберите цвет для лёгкой идентификации","createTitle": "Создать тег","editTitle": "Редактировать тег",+ "tabHasSettings": "Есть пользовательские настройки","updateTag": "Обновить тег","customPrompt": "Пользовательский запрос для резюме","customPromptPlaceholder": "Необязательно: пользовательский запрос для генерации резюме записей с этим тегом",diff --git a/static/locales/zh.json b/static/locales/zh.jsonindex fa272df3..e2aaf16a 100644--- a/static/locales/zh.json+++ b/static/locales/zh.json@@ -559,6 +559,7 @@"colorDescription": "选择颜色以便识别","createTitle": "创建标签","editTitle": "编辑标签",+ "tabHasSettings": "有自定义设置","updateTag": "更新标签","customPrompt": "自定义摘要提示","customPromptPlaceholder": "可选:为带有此标签的录音生成摘要的自定义提示",diff --git a/templates/account.html b/templates/account.htmlindex a8e9bf27..5192984f 100644--- a/templates/account.html+++ b/templates/account.html@@ -2127,13 +2127,13 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co<div class="border-b border-[var(--border-primary)]"><nav class="flex -mb-px space-x-1" id="tagModalTabs"><button type="button" class="tag-modal-tab active px-3 py-2 text-xs font-medium rounded-t-md border-b-2 border-[var(--border-focus)] text-[var(--text-accent)]" data-tab="tagTabTranscription">- <i class="fas fa-microphone mr-1"></i>Transcription+ <i class="fas fa-microphone mr-1"></i>Transcription<span class="tab-mod-dot hidden inline-block w-1.5 h-1.5 rounded-full bg-[var(--text-accent)] ml-1 align-middle"></span></button><button type="button" class="tag-modal-tab px-3 py-2 text-xs font-medium rounded-t-md border-b-2 border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)]" data-tab="tagTabSummary">- <i class="fas fa-file-alt mr-1"></i>Summary & Templates+ <i class="fas fa-file-alt mr-1"></i>Summary & Templates<span class="tab-mod-dot hidden inline-block w-1.5 h-1.5 rounded-full bg-[var(--text-accent)] ml-1 align-middle"></span></button><button type="button" id="tagTabSharingBtn" class="tag-modal-tab px-3 py-2 text-xs font-medium rounded-t-md border-b-2 border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hidden" data-tab="tagTabSharing">- <i class="fas fa-users mr-1"></i>Sharing+ <i class="fas fa-users mr-1"></i>Sharing<span class="tab-mod-dot hidden inline-block w-1.5 h-1.5 rounded-full bg-[var(--text-accent)] ml-1 align-middle"></span></button></nav></div>@@ -2345,13 +2345,13 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co<div class="border-b border-[var(--border-primary)]"><nav class="flex -mb-px space-x-1" id="folderModalTabs"><button type="button" class="folder-modal-tab active px-3 py-2 text-xs font-medium rounded-t-md border-b-2 border-[var(--border-focus)] text-[var(--text-accent)]" data-tab="folderTabTranscription">- <i class="fas fa-microphone mr-1"></i><span data-i18n="folderManagement.tabTranscription">Transcription</span>+ <i class="fas fa-microphone mr-1"></i><span data-i18n="folderManagement.tabTranscription">Transcription</span><span class="tab-mod-dot hidden inline-block w-1.5 h-1.5 rounded-full bg-[var(--text-accent)] ml-1 align-middle"></span></button><button type="button" class="folder-modal-tab px-3 py-2 text-xs font-medium rounded-t-md border-b-2 border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)]" data-tab="folderTabSummary">- <i class="fas fa-file-alt mr-1"></i><span data-i18n="folderManagement.tabSummary">Summary & Templates</span>+ <i class="fas fa-file-alt mr-1"></i><span data-i18n="folderManagement.tabSummary">Summary & Templates</span><span class="tab-mod-dot hidden inline-block w-1.5 h-1.5 rounded-full bg-[var(--text-accent)] ml-1 align-middle"></span></button><button type="button" id="folderTabSharingBtn" class="folder-modal-tab px-3 py-2 text-xs font-medium rounded-t-md border-b-2 border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hidden" data-tab="folderTabSharing">- <i class="fas fa-users mr-1"></i><span data-i18n="folderManagement.tabSharing">Sharing</span>+ <i class="fas fa-users mr-1"></i><span data-i18n="folderManagement.tabSharing">Sharing</span><span class="tab-mod-dot hidden inline-block w-1.5 h-1.5 rounded-full bg-[var(--text-accent)] ml-1 align-middle"></span></button></nav></div>@@ -4624,6 +4624,64 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</codocument.getElementById('folderTabSharingBtn')?.classList.remove('hidden');}+ // ===== TAB "HAS CUSTOM SETTINGS" INDICATORS =====+ // Each tab in the tag/folder edit modals shows a small accent dot+ // when it contains any non-default setting, so the user can see at+ // a glance which tabs hold customisations for this tag/folder+ // without clicking through every tab. Field lists below map each+ // tab to the inputs that count as a "setting"; sharing only counts+ // the group assignment (the auto-share checkboxes default on and+ // are only meaningful once a group is chosen).+ const TAG_TAB_FIELDS = {+ tagTabTranscription: ['tagLanguage','tagMinSpeakers','tagMaxSpeakers','tagHotwords','tagInitialPrompt','tagTranscriptionModel','tagRetentionDays','tagProtectFromDeletion'],+ tagTabSummary: ['tagCustomPrompt','tagNamingTemplate','tagExportTemplate'],+ tagTabSharing: ['tagGroupId'],+ };+ const FOLDER_TAB_FIELDS = {+ folderTabTranscription: ['folderLanguage','folderMinSpeakers','folderMaxSpeakers','folderHotwords','folderInitialPrompt','folderTranscriptionModel','folderRetentionDays','folderProtectFromDeletion'],+ folderTabSummary: ['folderCustomPrompt','folderNamingTemplate','folderExportTemplate'],+ folderTabSharing: ['folderGroupId'],+ };++ function fieldHasValue(id) {+ const el = document.getElementById(id);+ if (!el) return false;+ if (el.type === 'checkbox') return el.checked;+ // For text/number inputs and selects: a non-empty value is a+ // customisation. Selects use value="" for their default option.+ return (el.value || '').trim() !== '';+ }++ function refreshModalTabIndicators(navId, tabFields) {+ const nav = document.getElementById(navId);+ if (!nav) return;+ const dotTitle = (window.i18n && window.i18n.t)+ ? window.i18n.t('editTagModal.tabHasSettings')+ : 'Has custom settings';+ Object.entries(tabFields).forEach(([tabId, fields]) => {+ const btn = nav.querySelector('[data-tab="' + tabId + '"]');+ if (!btn) return;+ const dot = btn.querySelector('.tab-mod-dot');+ if (!dot) return;+ const modified = fields.some(fieldHasValue);+ dot.classList.toggle('hidden', !modified);+ dot.title = dotTitle;+ });+ }++ const refreshTagTabIndicators = () => refreshModalTabIndicators('tagModalTabs', TAG_TAB_FIELDS);+ const refreshFolderTabIndicators = () => refreshModalTabIndicators('folderModalTabs', FOLDER_TAB_FIELDS);+ // Expose so the async template-dropdown loaders can call back once+ // they've set their <select> values (which happens after open).+ window._refreshTagTabIndicators = refreshTagTabIndicators;+ window._refreshFolderTabIndicators = refreshFolderTabIndicators;++ // Live update as the user edits fields inside either modal.+ document.getElementById('tagModal')?.addEventListener('input', refreshTagTabIndicators);+ document.getElementById('tagModal')?.addEventListener('change', refreshTagTabIndicators);+ document.getElementById('folderModal')?.addEventListener('input', refreshFolderTabIndicators);+ document.getElementById('folderModal')?.addEventListener('change', refreshFolderTabIndicators);+// ===== TAG MANAGEMENT FUNCTIONALITY =====// Tag management elements@@ -5153,15 +5211,23 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</corefreshTagAutoProcessVariableWarning();}- // Load naming templates for dropdown- loadNamingTemplatesForTagModal();-- // Load export templates for dropdown- loadExportTemplatesForTagModal();+ // Load naming + export templates for dropdowns. These are+ // async (they fetch then restore the selected value), so+ // re-run the tab indicators once they settle to catch the+ // Summary tab's template selections.+ Promise.allSettled([+ loadNamingTemplatesForTagModal(),+ loadExportTemplatesForTagModal()+ ]).then(refreshTagTabIndicators);// Reset to first tabswitchModalTab('tagModalTabs', 'tag-modal-tab', 'tag-modal-tab-content', 'tagTabTranscription');+ // Mark which tabs hold custom settings. Run now for the+ // synchronously-populated fields; the naming/export template+ // loaders re-run it once their async <select> values are set.+ refreshTagTabIndicators();+tagModal.classList.remove('hidden');}@@ -5875,15 +5941,21 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</codocument.getElementById('folderId').value = '';}- // Load naming templates for dropdown (pass folder to set initial value)- loadNamingTemplatesForFolderModal(folder);-- // Load export templates for dropdown (pass folder to set initial value)- loadExportTemplatesForFolderModal(folder);+ // Load naming + export templates (async; restore selected+ // value), then re-run tab indicators so the Summary tab's+ // template selections are reflected once they settle.+ Promise.allSettled([+ loadNamingTemplatesForFolderModal(folder),+ loadExportTemplatesForFolderModal(folder)+ ]).then(refreshFolderTabIndicators);// Reset to first tabswitchModalTab('folderModalTabs', 'folder-modal-tab', 'folder-modal-tab-content', 'folderTabTranscription');+ // Mark which tabs hold custom settings (async template loaders+ // re-run this once their <select> values are populated).+ refreshFolderTabIndicators();+if (folderModal) folderModal.classList.remove('hidden');}