Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

feat: create tags and folders inline from the upload dialog via shared organizer modals (extracted from account page), with the new entity applied to the selection on save

Murtaza Nasir3086d6bb75c4
diff --git a/src/app.py b/src/app.py
index 0abf95f4..34758f31 100644
--- a/src/app.py
+++ b/src/app.py
@@ -673,18 +673,30 @@ def inject_help_center_link():
@app.context_processor
def inject_group_admin_status():
- """Inject is_group_admin flag into all templates."""
+ """Inject is_group_admin flag and the admin-group list into all templates.
+
+ user_admin_groups feeds the shared tag/folder modals (group assignment
+ dropdown), which render on the account page AND the main app now that
+ tags/folders can be created inline from the upload dialog.
+ """
from flask_login import current_user
from src.models.organization import GroupMembership
- is_group_admin = False
+ user_admin_groups = []
if current_user.is_authenticated:
- is_group_admin = GroupMembership.query.filter_by(
+ memberships = GroupMembership.query.filter_by(
user_id=current_user.id,
role='admin'
- ).first() is not None
+ ).all()
+ user_admin_groups = [
+ {'id': m.group.id, 'name': m.group.name}
+ for m in memberships if m.group
+ ]
- return {'is_group_admin': is_group_admin}
+ return {
+ 'is_group_admin': bool(user_admin_groups),
+ 'user_admin_groups': user_admin_groups,
+ }
# Ensure upload and instance directories exist
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index bed4f78e..af5283b4 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -2473,6 +2473,43 @@ document.addEventListener('DOMContentLoaded', async () => {
const uploadComposable = useUpload(state, utils);
+ // --- Inline tag/folder creation from the upload dialog ---
+ // Opens the shared organizer modals (organizer-modals.js standalone
+ // mode) and applies the created entity to the current selection.
+ const createTagFromUploadSearch = () => {
+ if (!window.SpeakrOrganizer) return;
+ window.SpeakrOrganizer.openTagCreate({
+ name: (uploadTagSearchFilter.value || '').trim(),
+ onSaved: async (tag) => {
+ await recordingsComposable.loadTags();
+ uploadComposable.addTagToSelection(tag.id);
+ uploadTagSearchFilter.value = '';
+ },
+ });
+ };
+ const createFolderFromUpload = () => {
+ if (!window.SpeakrOrganizer) return;
+ window.SpeakrOrganizer.openFolderCreate({
+ onSaved: async (folder) => {
+ await recordingsComposable.loadFolders();
+ selectedFolderId.value = folder.id;
+ },
+ });
+ };
+ // The folder <select> offers a "+ New folder" sentinel option;
+ // revert the selection and open the create modal. The revert must
+ // wait a tick: same-tick restore leaves the net value unchanged,
+ // so Vue would skip the DOM patch and the select would stay stuck
+ // on the sentinel option.
+ watch(selectedFolderId, (val, oldVal) => {
+ if (val === '__create__') {
+ nextTick(() => {
+ selectedFolderId.value = oldVal === '__create__' ? null : oldVal;
+ });
+ createFolderFromUpload();
+ }
+ });
+
// Upload disclaimer handlers
const acceptUploadDisclaimer = () => {
showUploadDisclaimerModal.value = false;
@@ -4379,7 +4416,11 @@ document.addEventListener('DOMContentLoaded', async () => {
...foldersComposable,
...pwaComposable,
...bulkSelectionComposable,
- ...bulkOperationsComposable
+ ...bulkOperationsComposable,
+
+ // Inline tag/folder creation (upload dialog)
+ createTagFromUploadSearch,
+ createFolderFromUpload
};
},
delimiters: ['${', '}']
diff --git a/static/js/organizer-modals.js b/static/js/organizer-modals.js
new file mode 100644
index 00000000..a81e9b3e
--- /dev/null
+++ b/static/js/organizer-modals.js
@@ -0,0 +1,388 @@
+/**
+ * Shared driver for the Tag / Folder editor modals
+ * (templates/includes/organizer_modals.html).
+ *
+ * Two consumers:
+ * - account.html (full management UI). Its inline script owns the modals'
+ * open/edit/submit lifecycle and uses only the shared helpers exported
+ * here (payload builders, template-dropdown filler), so the request
+ * payloads can never drift between pages.
+ * - index.html (the main app). No management UI of its own, so this module
+ * runs in STANDALONE mode there: `openTagCreate` / `openFolderCreate`
+ * open the same modals in creation mode, submit with the full field set,
+ * and hand the created entity back through `onSaved` so the caller (the
+ * upload dialog) can apply it in place.
+ *
+ * Standalone mode self-arms only on pages WITHOUT the account grids, so the
+ * two sets of submit handlers can never double-fire.
+ */
+(function () {
+ 'use strict';
+
+ const isAccountPage = () => !!document.getElementById('tagsGrid');
+
+ function csrfHeaders() {
+ const headers = { 'Content-Type': 'application/json' };
+ const token = document.querySelector('meta[name=csrf-token]');
+ if (token) headers['X-CSRFToken'] = token.getAttribute('content');
+ return headers;
+ }
+
+ // ------------------------------------------------------------------
+ // Shared helpers (used by BOTH the account page and standalone mode)
+ // ------------------------------------------------------------------
+
+ /**
+ * Fill a template <select> from an API listing. opts.selected sets an
+ * explicit value (edit flows); otherwise the current value is preserved
+ * (repopulation). opts.markDefault appends " (Default)".
+ */
+ async function loadTemplateOptionsInto(selectId, url, defaultLabel, opts = {}) {
+ const select = document.getElementById(selectId);
+ if (!select) return;
+ try {
+ const response = await fetch(url);
+ if (!response.ok) return;
+ const templates = await response.json();
+ const previous = select.value;
+ select.textContent = '';
+ const defaultOpt = document.createElement('option');
+ defaultOpt.value = '';
+ defaultOpt.textContent = defaultLabel;
+ select.appendChild(defaultOpt);
+ templates.forEach((template) => {
+ const option = document.createElement('option');
+ option.value = template.id;
+ option.textContent = template.name + (opts.markDefault && template.is_default ? ' (Default)' : '');
+ if (template.description) option.title = template.description;
+ select.appendChild(option);
+ });
+ const wanted = opts.selected !== undefined && opts.selected !== null
+ ? String(opts.selected) : previous;
+ if (wanted) select.value = wanted;
+ } catch (error) {
+ console.error('Error loading template options for ' + selectId + ':', error);
+ }
+ }
+
+ /** Assemble the tag create/update payload from the tag modal form. */
+ function buildTagPayload(tagForm) {
+ const formData = new FormData(tagForm);
+
+ const isProtected = document.getElementById('tagProtectFromDeletion')?.checked || false;
+ let retentionDays = null;
+ if (isProtected) {
+ retentionDays = -1; // protected / infinite retention
+ } else {
+ const retentionInput = formData.get('retention_days');
+ retentionDays = retentionInput ? parseInt(retentionInput) : null;
+ }
+
+ const namingTemplateId = formData.get('naming_template_id');
+ const exportTemplateId = formData.get('export_template_id');
+ const tagData = {
+ name: formData.get('name'),
+ color: formData.get('color'),
+ custom_prompt: formData.get('custom_prompt') || null,
+ naming_template_id: namingTemplateId ? parseInt(namingTemplateId) : null,
+ export_template_id: exportTemplateId ? parseInt(exportTemplateId) : null,
+ default_language: formData.get('default_language') || null,
+ default_min_speakers: formData.get('default_min_speakers') ? parseInt(formData.get('default_min_speakers')) : null,
+ default_max_speakers: formData.get('default_max_speakers') ? parseInt(formData.get('default_max_speakers')) : null,
+ default_hotwords: formData.get('default_hotwords') || null,
+ default_initial_prompt: formData.get('default_initial_prompt') || null,
+ default_transcription_model: formData.get('default_transcription_model') || null,
+ retention_days: retentionDays,
+ is_auto_process: document.getElementById('tagAutoProcess')?.checked || false,
+ };
+
+ const groupId = formData.get('group_id');
+ if (groupId) {
+ tagData.group_id = parseInt(groupId);
+ tagData.auto_share_on_apply = document.getElementById('tagAutoShareOnApply')?.checked || false;
+ tagData.share_with_group_lead = document.getElementById('tagShareWithGroupLead')?.checked || false;
+ } else {
+ tagData.group_id = null;
+ }
+ return tagData;
+ }
+
+ /** Assemble the folder create/update payload from the folder modal form. */
+ function buildFolderPayload() {
+ const val = (id) => {
+ const el = document.getElementById(id);
+ return el ? el.value.trim() || null : null;
+ };
+ const intVal = (id) => {
+ const el = document.getElementById(id);
+ return el && el.value ? parseInt(el.value) : null;
+ };
+
+ const folderData = {
+ name: (document.getElementById('folderName')?.value || '').trim(),
+ color: document.getElementById('folderColor')?.value,
+ custom_prompt: val('folderCustomPrompt'),
+ default_language: val('folderLanguage'),
+ default_min_speakers: intVal('folderMinSpeakers'),
+ default_max_speakers: intVal('folderMaxSpeakers'),
+ default_hotwords: val('folderHotwords'),
+ default_initial_prompt: val('folderInitialPrompt'),
+ default_transcription_model: val('folderTranscriptionModel'),
+ naming_template_id: intVal('folderNamingTemplate'),
+ export_template_id: intVal('folderExportTemplate'),
+ };
+
+ const groupIdEl = document.getElementById('folderGroupId');
+ if (groupIdEl && groupIdEl.value) {
+ folderData.group_id = parseInt(groupIdEl.value);
+ const autoShareEl = document.getElementById('folderAutoShareOnApply');
+ folderData.auto_share_on_apply = autoShareEl ? autoShareEl.checked : true;
+ const shareLeadEl = document.getElementById('folderShareWithGroupLead');
+ folderData.share_with_group_lead = shareLeadEl ? shareLeadEl.checked : true;
+ }
+
+ const protect = document.getElementById('folderProtectFromDeletion');
+ const retention = document.getElementById('folderRetentionDays');
+ if (protect && protect.checked) {
+ folderData.retention_days = -1;
+ } else if (retention && retention.value) {
+ folderData.retention_days = parseInt(retention.value);
+ }
+ return folderData;
+ }
+
+ function switchOrganizerModalTab(navId, tabClass, contentClass, targetTabId) {
+ const nav = document.getElementById(navId);
+ if (!nav) return;
+ nav.querySelectorAll('.' + tabClass).forEach((btn) => {
+ if (btn.dataset.tab === targetTabId) {
+ btn.classList.add('active', 'border-[var(--border-focus)]', 'text-[var(--text-accent)]');
+ btn.classList.remove('border-transparent', 'text-[var(--text-muted)]');
+ } else {
+ btn.classList.remove('active', 'border-[var(--border-focus)]', 'text-[var(--text-accent)]');
+ btn.classList.add('border-transparent', 'text-[var(--text-muted)]');
+ }
+ });
+ document.querySelectorAll('.' + contentClass).forEach((panel) => {
+ panel.classList.toggle('hidden', panel.id !== targetTabId);
+ });
+ }
+
+ // ------------------------------------------------------------------
+ // Standalone creation mode (main app: inline create from upload dialog)
+ // ------------------------------------------------------------------
+
+ let standaloneArmed = false;
+ let activeSubmit = null; // { form, handler } while a standalone modal is open
+
+ function adminGroups() {
+ try {
+ const holder = document.getElementById('organizerModals');
+ return JSON.parse(holder?.dataset.adminGroups || '[]');
+ } catch (_) {
+ return [];
+ }
+ }
+
+ /** Translate a key via the global i18n bundle, falling back to English. */
+ function tr(key, fallback, params) {
+ if (window.i18n && typeof window.i18n.t === 'function') {
+ const translated = window.i18n.t(key, params);
+ if (translated && translated !== key) return translated;
+ }
+ return fallback;
+ }
+
+ function armStandalone() {
+ if (standaloneArmed || isAccountPage()) return;
+ standaloneArmed = true;
+
+ // The main app only translates Vue-rendered text; apply the included
+ // modal markup's data-i18n attributes here (i18n is initialized well
+ // before any user click can reach this).
+ if (window.i18n && typeof window.i18n.t === 'function') {
+ const root = document.getElementById('organizerModals');
+ root?.querySelectorAll('[data-i18n]').forEach((el) => {
+ const key = el.getAttribute('data-i18n');
+ const translated = window.i18n.t(key);
+ if (translated && translated !== key) el.textContent = translated;
+ });
+ root?.querySelectorAll('[data-i18n-placeholder]').forEach((el) => {
+ const key = el.getAttribute('data-i18n-placeholder');
+ const translated = window.i18n.t(key);
+ if (translated && translated !== key) el.placeholder = translated;
+ });
+ }
+
+ // Modal tab strips (the account page binds its own copies of these).
+ document.getElementById('tagModalTabs')?.addEventListener('click', (e) => {
+ const btn = e.target.closest('.tag-modal-tab');
+ if (btn && btn.dataset.tab) {
+ switchOrganizerModalTab('tagModalTabs', 'tag-modal-tab', 'tag-modal-tab-content', btn.dataset.tab);
+ }
+ });
+ document.getElementById('folderModalTabs')?.addEventListener('click', (e) => {
+ const btn = e.target.closest('.folder-modal-tab');
+ if (btn && btn.dataset.tab) {
+ switchOrganizerModalTab('folderModalTabs', 'folder-modal-tab', 'folder-modal-tab-content', btn.dataset.tab);
+ }
+ });
+
+ // Close buttons and group-section visibility toggles.
+ document.getElementById('closeTagModalBtn')?.addEventListener('click', () => hideModal('tagModal'));
+ document.getElementById('cancelTagBtn')?.addEventListener('click', () => hideModal('tagModal'));
+ document.getElementById('closeFolderModalBtn')?.addEventListener('click', () => hideModal('folderModal'));
+ document.getElementById('cancelFolderBtn')?.addEventListener('click', () => hideModal('folderModal'));
+ document.getElementById('tagGroupId')?.addEventListener('change', function () {
+ document.getElementById('tagGroupSettingsSection')?.classList.toggle('hidden', !this.value);
+ });
+ document.getElementById('folderGroupId')?.addEventListener('change', function () {
+ document.getElementById('folderGroupSettingsSection')?.classList.toggle('hidden', !this.value);
+ });
+ }
+
+ function hideModal(id) {
+ document.getElementById(id)?.classList.add('hidden');
+ if (activeSubmit) {
+ activeSubmit.form.removeEventListener('submit', activeSubmit.handler);
+ activeSubmit = null;
+ }
+ }
+
+ function populateGroupSelect(selectId, sectionId, tabBtnId) {
+ const groups = adminGroups();
+ const select = document.getElementById(selectId);
+ if (select) {
+ while (select.options.length > 1) select.remove(1);
+ groups.forEach((group) => {
+ const option = document.createElement('option');
+ option.value = group.id;
+ option.textContent = group.name;
+ select.appendChild(option);
+ });
+ select.value = '';
+ }
+ // Sharing tab / group section only make sense with admin groups.
+ const tabBtn = tabBtnId && document.getElementById(tabBtnId);
+ if (tabBtn) tabBtn.classList.toggle('hidden', groups.length === 0);
+ const section = sectionId && document.getElementById(sectionId);
+ if (section) section.classList.toggle('hidden', groups.length === 0);
+ }
+
+ function bindSubmit(form, handler) {
+ if (activeSubmit) activeSubmit.form.removeEventListener('submit', activeSubmit.handler);
+ activeSubmit = { form, handler };
+ form.addEventListener('submit', handler);
+ }
+
+ /** Open the tag modal in creation mode (standalone pages). */
+ function openTagCreate(opts = {}) {
+ armStandalone();
+ const form = document.getElementById('tagForm');
+ const overlay = document.getElementById('tagModal');
+ if (!form || !overlay) return;
+ form.reset();
+ document.getElementById('tagId').value = '';
+ if (opts.name) document.getElementById('tagName').value = opts.name;
+ const title = document.getElementById('tagModalTitle');
+ if (title) title.textContent = tr('editTagModal.createTitle', 'Create Tag');
+ const save = document.getElementById('saveTagBtn');
+ if (save) {
+ save.textContent = '';
+ const icon = document.createElement('i');
+ icon.className = 'fas fa-plus mr-2';
+ save.appendChild(icon);
+ save.appendChild(document.createTextNode(' ' + tr('editTagModal.createTitle', 'Create Tag')));
+ }
+ populateGroupSelect('tagGroupId', 'tagGroupSelectionSection', 'tagTabSharingBtn');
+ document.getElementById('tagGroupSettingsSection')?.classList.add('hidden');
+ switchOrganizerModalTab('tagModalTabs', 'tag-modal-tab', 'tag-modal-tab-content', 'tagTabTranscription');
+ loadTemplateOptionsInto('tagNamingTemplate', '/api/naming-templates', 'No template (use user default or AI title)', { selected: '' });
+ loadTemplateOptionsInto('tagExportTemplate', '/api/export-templates', 'No template (use user default)', { selected: '', markDefault: true });
+
+ bindSubmit(form, async (e) => {
+ e.preventDefault();
+ try {
+ const response = await fetch('/api/tags', {
+ method: 'POST',
+ headers: csrfHeaders(),
+ body: JSON.stringify(buildTagPayload(form)),
+ });
+ if (!response.ok) {
+ const errorData = await response.json().catch(() => ({}));
+ throw new Error(errorData.error || ('HTTP ' + response.status));
+ }
+ const saved = await response.json();
+ hideModal('tagModal');
+ if (opts.onSaved) opts.onSaved(saved);
+ } catch (error) {
+ alert('Could not create tag: ' + error.message);
+ }
+ });
+ overlay.classList.remove('hidden');
+ setTimeout(() => document.getElementById('tagName')?.focus(), 50);
+ }
+
+ /** Open the folder modal in creation mode (standalone pages). */
+ function openFolderCreate(opts = {}) {
+ armStandalone();
+ const form = document.getElementById('folderForm');
+ const overlay = document.getElementById('folderModal');
+ if (!form || !overlay) return;
+ form.reset();
+ document.getElementById('folderId').value = '';
+ if (opts.name) document.getElementById('folderName').value = opts.name;
+ const title = document.getElementById('folderModalTitle');
+ if (title) title.textContent = tr('folderManagement.createFolderTitle', 'Create Folder');
+ const save = document.getElementById('saveFolderBtn');
+ if (save) {
+ save.textContent = '';
+ const icon = document.createElement('i');
+ icon.className = 'fas fa-plus mr-2';
+ save.appendChild(icon);
+ const label = document.createElement('span');
+ label.textContent = tr('folderManagement.createFolderTitle', 'Create Folder');
+ save.appendChild(document.createTextNode(' '));
+ save.appendChild(label);
+ }
+ populateGroupSelect('folderGroupId', 'folderGroupSelectionSection', 'folderTabSharingBtn');
+ document.getElementById('folderGroupSettingsSection')?.classList.add('hidden');
+ switchOrganizerModalTab('folderModalTabs', 'folder-modal-tab', 'folder-modal-tab-content', 'folderTabTranscription');
+ loadTemplateOptionsInto('folderNamingTemplate', '/api/naming-templates', 'No template (use user default or AI title)', { selected: '' });
+ loadTemplateOptionsInto('folderExportTemplate', '/api/export-templates', 'No template (use user default)', { selected: '', markDefault: true });
+
+ bindSubmit(form, async (e) => {
+ e.preventDefault();
+ const name = (document.getElementById('folderName')?.value || '').trim();
+ if (!name) return;
+ try {
+ const response = await fetch('/api/folders', {
+ method: 'POST',
+ headers: csrfHeaders(),
+ body: JSON.stringify(buildFolderPayload()),
+ });
+ if (!response.ok) {
+ const errorData = await response.json().catch(() => ({}));
+ throw new Error(errorData.error || ('HTTP ' + response.status));
+ }
+ const saved = await response.json();
+ hideModal('folderModal');
+ if (opts.onSaved) opts.onSaved(saved);
+ } catch (error) {
+ alert('Could not create folder: ' + error.message);
+ }
+ });
+ overlay.classList.remove('hidden');
+ setTimeout(() => document.getElementById('folderName')?.focus(), 50);
+ }
+
+ window.SpeakrOrganizer = {
+ loadTemplateOptionsInto,
+ buildTagPayload,
+ buildFolderPayload,
+ openTagCreate,
+ openFolderCreate,
+ };
+ // The account page's inline script calls this by its bare name.
+ window.loadTemplateOptionsInto = loadTemplateOptionsInto;
+})();
diff --git a/static/locales/de.json b/static/locales/de.json
index 1a3db4c7..40906b98 100644
--- a/static/locales/de.json
+++ b/static/locales/de.json
@@ -889,7 +889,8 @@
"transcriptionModel": "Transkriptionsmodell",
"useResolvedDefault": "(Tag-/Ordner-/globalen Standard verwenden)",
"defaultTranscriptionModel": "Standard-Transkriptionsmodell",
- "defaultTranscriptionModelHelp": "Überschreibt das Transkriptionsmodell für Aufnahmen mit diesem Tag oder Ordner."
+ "defaultTranscriptionModelHelp": "Überschreibt das Transkriptionsmodell für Aufnahmen mit diesem Tag oder Ordner.",
+ "newFolderOption": "Neuer Ordner…"
},
"groups": {
"addMembers": "Mitglieder hinzufügen...",
@@ -1045,7 +1046,9 @@
"uploadingRecording": "Aufnahme wird hochgeladen…",
"whatWillHappen": "Was wird passieren?",
"whyNotWorking": "Warum funktioniert es nicht?",
- "youHaveXSpeakers": "Sie haben {{count}} Sprecher, aber nur 16 eindeutige Farben sind verfügbar. Die Farben wiederholen sich nach dem 16. Sprecher."
+ "youHaveXSpeakers": "Sie haben {{count}} Sprecher, aber nur 16 eindeutige Farben sind verfügbar. Die Farben wiederholen sich nach dem 16. Sprecher.",
+ "createTagNamed": "Tag \"{{name}}\" erstellen",
+ "newTag": "Neues Tag"
},
"incognito": {
"audioNotStored": "Audio wird im Inkognito-Modus nicht gespeichert",
diff --git a/static/locales/en.json b/static/locales/en.json
index b6eccb9b..c88eb676 100644
--- a/static/locales/en.json
+++ b/static/locales/en.json
@@ -889,7 +889,8 @@
"transcriptionLanguage": "Transcription Language",
"yourFullName": "Your full name",
"transcriptionModel": "Transcription model",
- "useResolvedDefault": "(use tag/folder/global default)"
+ "useResolvedDefault": "(use tag/folder/global default)",
+ "newFolderOption": "New folder…"
},
"groups": {
"addMembers": "Add members...",
@@ -1045,7 +1046,9 @@
"uploadingRecording": "Uploading recording…",
"whatWillHappen": "What will happen?",
"whyNotWorking": "Why isn't it working?",
- "youHaveXSpeakers": "You have {{count}} speakers, but only 16 unique colors are available. Colors will repeat after the 16th speaker."
+ "youHaveXSpeakers": "You have {{count}} speakers, but only 16 unique colors are available. Colors will repeat after the 16th speaker.",
+ "createTagNamed": "Create tag \"{{name}}\"",
+ "newTag": "New tag"
},
"incognito": {
"audioNotStored": "Audio not stored in incognito mode",
diff --git a/static/locales/es.json b/static/locales/es.json
index d7b56e86..0db4d42a 100644
--- a/static/locales/es.json
+++ b/static/locales/es.json
@@ -889,7 +889,8 @@
"transcriptionModel": "Modelo de transcripción",
"useResolvedDefault": "(usar valor por defecto de etiqueta/carpeta/global)",
"defaultTranscriptionModel": "Modelo de transcripción por defecto",
- "defaultTranscriptionModelHelp": "Sobrescribe el modelo de transcripción usado para grabaciones con esta etiqueta o carpeta."
+ "defaultTranscriptionModelHelp": "Sobrescribe el modelo de transcripción usado para grabaciones con esta etiqueta o carpeta.",
+ "newFolderOption": "Nueva carpeta…"
},
"groups": {
"addMembers": "Añadir miembros...",
@@ -1045,7 +1046,9 @@
"uploadingRecording": "Subiendo la grabación…",
"whatWillHappen": "¿Qué pasará?",
"whyNotWorking": "¿Por qué no funciona?",
- "youHaveXSpeakers": "Tiene {{count}} oradores, pero solo hay 16 colores únicos disponibles. Los colores se repetirán después del decimosexto orador."
+ "youHaveXSpeakers": "Tiene {{count}} oradores, pero solo hay 16 colores únicos disponibles. Los colores se repetirán después del decimosexto orador.",
+ "createTagNamed": "Crear etiqueta \"{{name}}\"",
+ "newTag": "Nueva etiqueta"
},
"incognito": {
"audioNotStored": "El audio no se almacena en modo incógnito",
diff --git a/static/locales/fr.json b/static/locales/fr.json
index 346d072b..aac6a355 100644
--- a/static/locales/fr.json
+++ b/static/locales/fr.json
@@ -889,7 +889,8 @@
"transcriptionModel": "Modèle de transcription",
"useResolvedDefault": "(utiliser la valeur par défaut tag/dossier/global)",
"defaultTranscriptionModel": "Modèle de transcription par défaut",
- "defaultTranscriptionModelHelp": "Remplace le modèle de transcription utilisé pour les enregistrements avec ce tag ou ce dossier."
+ "defaultTranscriptionModelHelp": "Remplace le modèle de transcription utilisé pour les enregistrements avec ce tag ou ce dossier.",
+ "newFolderOption": "Nouveau dossier…"
},
"groups": {
"addMembers": "Ajouter des membres...",
@@ -1045,7 +1046,9 @@
"uploadingRecording": "Envoi de l'enregistrement…",
"whatWillHappen": "Que va-t-il se passer?",
"whyNotWorking": "Pourquoi ça ne marche pas?",
- "youHaveXSpeakers": "Vous avez {{count}} locuteurs, mais seulement 16 couleurs uniques sont disponibles. Les couleurs se répéteront après le 16ème locuteur."
+ "youHaveXSpeakers": "Vous avez {{count}} locuteurs, mais seulement 16 couleurs uniques sont disponibles. Les couleurs se répéteront après le 16ème locuteur.",
+ "createTagNamed": "Créer le tag \"{{name}}\"",
+ "newTag": "Nouveau tag"
},
"incognito": {
"audioNotStored": "Audio non stocké en mode incognito",
diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.json
index e1124fb0..878e4b4c 100644
--- a/static/locales/pt-BR.json
+++ b/static/locales/pt-BR.json
@@ -889,7 +889,8 @@
"defaultTranscriptionModel": "Modelo de transcrição padrão",
"defaultTranscriptionModelHelp": "Sobrescreve o modelo de transcrição usado para gravações com esta tag ou pasta.",
"transcriptionModel": "Modelo de transcrição",
- "useResolvedDefault": "(usar padrão de tag/pasta/global)"
+ "useResolvedDefault": "(usar padrão de tag/pasta/global)",
+ "newFolderOption": "Nova pasta…"
},
"groups": {
"addMembers": "Adicionar membros...",
@@ -1045,7 +1046,9 @@
"uploadingRecording": "Enviando a gravação…",
"whatWillHappen": "O que acontecerá?",
"whyNotWorking": "Por que não está funcionando?",
- "youHaveXSpeakers": "Você tem {{count}} oradores, mas apenas 16 cores únicas estão disponíveis. As cores se repetirão após o 16º orador."
+ "youHaveXSpeakers": "Você tem {{count}} oradores, mas apenas 16 cores únicas estão disponíveis. As cores se repetirão após o 16º orador.",
+ "createTagNamed": "Criar tag \"{{name}}\"",
+ "newTag": "Nova tag"
},
"incognito": {
"audioNotStored": "Áudio não armazenado em modo incógnito",
diff --git a/static/locales/ru.json b/static/locales/ru.json
index 0a38f2ec..2b667171 100644
--- a/static/locales/ru.json
+++ b/static/locales/ru.json
@@ -889,7 +889,8 @@
"transcriptionModel": "Модель транскрипции",
"useResolvedDefault": "(использовать стандарт тега/папки/глобальный)",
"defaultTranscriptionModel": "Модель транскрипции по умолчанию",
- "defaultTranscriptionModelHelp": "Переопределяет модель транскрипции для записей с этим тегом или папкой."
+ "defaultTranscriptionModelHelp": "Переопределяет модель транскрипции для записей с этим тегом или папкой.",
+ "newFolderOption": "Новая папка…"
},
"groups": {
"addMembers": "Добавить участников...",
@@ -1045,7 +1046,9 @@
"uploadingRecording": "Загрузка записи…",
"whatWillHappen": "Что произойдёт?",
"whyNotWorking": "Почему не работает?",
- "youHaveXSpeakers": "У вас {{count}} спикеров, но доступно только 16 уникальных цветов. Цвета будут повторяться после 16-го спикера."
+ "youHaveXSpeakers": "У вас {{count}} спикеров, но доступно только 16 уникальных цветов. Цвета будут повторяться после 16-го спикера.",
+ "createTagNamed": "Создать тег \"{{name}}\"",
+ "newTag": "Новый тег"
},
"incognito": {
"audioNotStored": "Аудио не сохраняется в режиме инкогнито",
diff --git a/static/locales/zh.json b/static/locales/zh.json
index 483b70c8..98278c8c 100644
--- a/static/locales/zh.json
+++ b/static/locales/zh.json
@@ -889,7 +889,8 @@
"transcriptionModel": "转录模型",
"useResolvedDefault": "(使用标签/文件夹/全局默认)",
"defaultTranscriptionModel": "默认转录模型",
- "defaultTranscriptionModelHelp": "覆盖此标签或文件夹下录音所使用的转录模型。"
+ "defaultTranscriptionModelHelp": "覆盖此标签或文件夹下录音所使用的转录模型。",
+ "newFolderOption": "新建文件夹…"
},
"groups": {
"addMembers": "添加成员...",
@@ -1045,7 +1046,9 @@
"uploadingRecording": "正在上传录音…",
"whatWillHappen": "会发生什么?",
"whyNotWorking": "为什么不工作?",
- "youHaveXSpeakers": "您有 {{count}} 位发言人,但只有16种独特的颜色可用。颜色将在第16位发言人之后重复。"
+ "youHaveXSpeakers": "您有 {{count}} 位发言人,但只有16种独特的颜色可用。颜色将在第16位发言人之后重复。",
+ "createTagNamed": "创建标签\"{{name}}\"",
+ "newTag": "新建标签"
},
"incognito": {
"audioNotStored": "隐身模式下不会保存音频",
diff --git a/templates/account.html b/templates/account.html
index b4ef76d9..5f1ca714 100644
--- a/templates/account.html
+++ b/templates/account.html
@@ -14,6 +14,7 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/primitives.css') }}">
<script src="{{ url_for('static', filename='js/i18n.js') }}"></script>
+ <script src="{{ url_for('static', filename='js/organizer-modals.js') }}"></script>
<!-- Loading overlay to prevent FOUC -->
{% include 'includes/loading_overlay.html' %}
@@ -2362,458 +2363,7 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
</div>
<!-- Create/Edit Tag Modal -->
- <div id="tagModal" class="modal-overlay hidden">
- <div class="modal-panel modal-panel--md">
- <div class="modal-header">
- <h3 id="tagModalTitle" class="modal-title" data-i18n="editTagModal.createTitle">Create Tag</h3>
- <button id="closeTagModalBtn" class="modal-close" title="Close"><i class="fas fa-times"></i></button>
- </div>
- <form id="tagForm" style="display: contents;">
- <div class="modal-body space-y-4">
- <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
- <input type="hidden" id="tagId" name="tag_id">
-
- <!-- Name and Color (always visible, outside tabs) -->
- <div>
- <label for="tagName" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.tagName">Tag Name *</label>
- <input type="text" id="tagName" name="name" required maxlength="50" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="e.g., Meetings, Interviews">
- </div>
-
- <div>
- <label for="tagColor" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.color">Color</label>
- <div class="flex items-center space-x-3">
- <input type="color" id="tagColor" name="color" value="#3B82F6" class="w-12 h-10 rounded border border-[var(--border-secondary)]">
- <span class="text-sm text-[var(--text-muted)]" data-i18n="editTagModal.colorDescription">Choose a color for easy identification</span>
- </div>
- </div>
-
- {% if enable_auto_processing %}
- <!-- Auto-process watch folder toggle -->
- <div id="tagAutoProcessRow" class="flex items-center justify-between py-2 px-3 bg-[var(--bg-tertiary)] rounded-md">
- <div class="flex items-center space-x-2">
- <i class="fas fa-folder-open text-[var(--text-muted)] text-sm"></i>
- <label for="tagAutoProcess" class="text-sm font-medium text-[var(--text-secondary)] cursor-pointer" data-i18n="editTagModal.watchFolder">Watch Folder</label>
- </div>
- <label class="relative inline-flex items-center cursor-pointer">
- <input type="checkbox" id="tagAutoProcess" class="sr-only peer">
- <div class="w-9 h-5 bg-[var(--bg-quaternary)] peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-[var(--border-focus)] rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-[var(--border-secondary)] after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[var(--bg-success)]"></div>
- </label>
- </div>
- <div id="tagAutoProcessPath" class="hidden px-3 py-2 bg-[var(--bg-tertiary)] rounded-md -mt-2">
- <span class="text-xs text-[var(--text-muted)]" data-i18n="editTagModal.watchFolderPath">Drop files in:</span>
- <code id="tagAutoProcessPathValue" class="block text-xs text-[var(--text-primary)] font-mono mt-1 break-all"></code>
- </div>
- {% endif %}
-
- <!-- Tab Navigation -->
- <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<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<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<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>
-
- <!-- Tab content area: wrapper keeps modal a consistent height across tabs -->
- <div class="modal-tabs-pane">
-
- <!-- Tab: Transcription & Retention -->
- <div id="tagTabTranscription" class="tag-modal-tab-content space-y-4">
- {% if connector_supports_diarization %}
- <div>
- <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3" data-i18n="editTagModal.asrDefaultSettings">Transcription Default Settings</h4>
- <div class="space-y-3">
- <div>
- <label for="tagLanguage" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="editTagModal.defaultLanguage">Default Language</label>
- <input type="text" id="tagLanguage" name="default_language" maxlength="10" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="e.g., en, es, zh">
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label for="tagMinSpeakers" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="editTagModal.minSpeakers">Min Speakers</label>
- <input type="number" id="tagMinSpeakers" name="default_min_speakers" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- </div>
- <div>
- <label for="tagMaxSpeakers" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="editTagModal.maxSpeakers">Max Speakers</label>
- <input type="number" id="tagMaxSpeakers" name="default_max_speakers" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- </div>
- </div>
- </div>
- </div>
- {% endif %}
-
- <!-- Hotwords & Initial Prompt -->
- {% if connector_supports_hotwords %}
- <div>
- <label for="tagHotwords" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.hotwords">Hotwords</label>
- <input type="text" id="tagHotwords" name="default_hotwords" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" data-i18n-placeholder="form.hotwordsPlaceholder" placeholder="e.g., Speakr, CTranslate2, PyAnnote">
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.hotwordsHelp">Comma-separated words to improve recognition of domain-specific terms</p>
- </div>
- {% endif %}
- {% if connector_supports_initial_prompt %}
- <div>
- <label for="tagInitialPrompt" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.initialPrompt">Initial Prompt</label>
- <select class="ip-template-picker w-full mb-2 px-3 py-2 border border-[var(--border-secondary)] rounded-md text-sm bg-[var(--bg-input)] text-[var(--text-primary)]" data-target="tagInitialPrompt" data-target-hotwords="tagHotwords" style="display:none">
- <option value="">Insert a saved prompt…</option>
- </select>
- <textarea id="tagInitialPrompt" name="default_initial_prompt" rows="2" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" data-i18n-placeholder="form.initialPromptPlaceholder" placeholder="e.g., This is a meeting about AI transcription tools."></textarea>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.initialPromptHelp">Context to steer the transcription model's style and vocabulary</p>
- </div>
- {% endif %}
-
- <!-- Default transcription model (issue #266) — only rendered when admin set TRANSCRIPTION_MODELS_AVAILABLE -->
- <div id="tagTranscriptionModelSection" class="hidden">
- <label for="tagTranscriptionModel" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.defaultTranscriptionModel">Default transcription model</label>
- <select id="tagTranscriptionModel" name="default_transcription_model" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- <option value="">(use admin/global default)</option>
- </select>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.defaultTranscriptionModelHelp">Override which transcription model is used for recordings with this tag.</p>
- </div>
-
- <!-- Retention Period Override (only shown when auto-deletion is enabled) -->
- <div id="tagRetentionSection" class="hidden border-t border-[var(--border-primary)] pt-4 mt-2">
- <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3">
- <i class="fas fa-clock mr-2"></i>Retention & Auto-Deletion
- </h4>
- <div class="space-y-3">
- <div id="tagRetentionDaysContainer">
- <label for="tagRetentionDays" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Retention Period (days)</label>
- <input type="number" id="tagRetentionDays" name="retention_days" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Leave empty to use global retention">
- <p class="text-xs text-[var(--text-light)] mt-1">Leave empty to use global retention period.</p>
- </div>
- <div class="flex items-start space-x-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md">
- <input type="checkbox" id="tagProtectFromDeletion" class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
- <div class="flex-1">
- <label for="tagProtectFromDeletion" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
- <i class="fas fa-shield-alt mr-1 text-yellow-600 dark:text-yellow-400"></i>
- Protect from Auto-Deletion (Infinite Retention)
- </label>
- <p class="text-xs text-[var(--text-light)] mt-1">Recordings with this tag will never be automatically deleted.</p>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- Tab: Summary & Templates -->
- <div id="tagTabSummary" class="tag-modal-tab-content space-y-4 hidden">
- <div>
- <label for="tagCustomPrompt" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.customPrompt">Custom Summary Prompt</label>
- <textarea id="tagCustomPrompt" name="custom_prompt" rows="4" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Optional: Custom prompt for generating summaries for recordings with this tag" data-i18n-placeholder="editTagModal.customPromptPlaceholder"></textarea>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="editTagModal.leaveBlankPrompt">Leave blank to use your default summary prompt</p>
-
- {# Warning when this tag uses placeholder variables AND is configured as a watch-folder (auto-process) tag.
- Drop-folder ingest has no UI for users to fill values, so placeholders silently substitute to empty strings. #}
- <div id="tagAutoProcessVariableWarning" class="hidden mt-2 flex items-start gap-2 p-2.5 bg-[var(--bg-warning-light)] border border-[var(--border-warning)] rounded-md text-xs text-[var(--text-warning-strong)]">
- <i class="fas fa-exclamation-triangle mt-0.5"></i>
- <span data-i18n="editTagModal.watchFolderVariableWarning">This tag is set up as a watch folder and the prompt contains placeholder variables. Recordings ingested through the auto-process directory have no UI for users to fill those values, so the placeholders will substitute to empty strings on the first summary run. Either remove the placeholders or fill the values via reprocess after upload.</span>
- </div>
- </div>
- <div>
- <label for="tagNamingTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.namingTemplate">Naming Template</label>
- <select id="tagNamingTemplate" name="naming_template_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- <option value="" data-i18n="editTagModal.noNamingTemplate">No template (use user default or AI title)</option>
- </select>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="editTagModal.namingTemplateHint">Select a naming template to automatically format titles for recordings with this tag</p>
- </div>
- {% if enable_auto_export %}
- <div>
- <label for="tagExportTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.exportTemplate">Export Template</label>
- <select id="tagExportTemplate" name="export_template_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- <option value="" data-i18n="editTagModal.noExportTemplate">No template (use user default)</option>
- </select>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="editTagModal.exportTemplateHint">Select an export template to use when exporting recordings with this tag</p>
- </div>
- {% endif %}
- </div>
-
- <!-- Tab: Sharing -->
- <div id="tagTabSharing" class="tag-modal-tab-content space-y-4 hidden">
- <div id="tagGroupSelectionSection" class="hidden">
- <label for="tagGroupId" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Group Assignment (Optional)</label>
- <select id="tagGroupId" name="group_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- <option value="" data-i18n="account.personalTag">Personal Tag (Not Associated with a Group)</option>
- </select>
- <p class="text-xs text-[var(--text-light)] mt-1">Assign this tag to a group to enable auto-sharing when applied to recordings</p>
- </div>
- <div id="tagGroupSettingsSection" class="hidden">
- <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3">
- <i class="fas fa-users mr-2"></i>Group Sharing Settings
- </h4>
- <div class="space-y-3">
- <div class="flex items-start space-x-3">
- <input type="checkbox" id="tagAutoShareOnApply" name="auto_share_on_apply" checked class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
- <div class="flex-1">
- <label for="tagAutoShareOnApply" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
- <i class="fas fa-share-alt mr-1"></i>Auto-share with all group members
- </label>
- <p class="text-xs text-[var(--text-light)] mt-1">All group members will automatically get access to recordings with this tag</p>
- </div>
- </div>
- <div class="flex items-start space-x-3">
- <input type="checkbox" id="tagShareWithGroupLead" name="share_with_group_lead" checked class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
- <div class="flex-1">
- <label for="tagShareWithGroupLead" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
- <i class="fas fa-user-shield mr-1"></i>Share with group admins only
- </label>
- <p class="text-xs text-[var(--text-light)] mt-1">Only group admins will get access (not all members)</p>
- </div>
- </div>
- </div>
- <p class="text-xs text-[var(--text-light)] italic mt-3">Note: If both are enabled, all group members will have access.</p>
- </div>
-
- <!-- Empty state: shown when internal sharing is enabled but the user
- is not an admin of any group (so they can't associate this tag
- with a group). Copy varies by site-admin status. -->
- <div id="tagSharingEmptyState" class="empty hidden">
- <div class="empty__icon"><i class="fas fa-users"></i></div>
- <div class="empty__title" data-i18n="folderManagement.sharingEmptyTitle">No groups available for sharing</div>
- <div class="empty__body">
- {% if current_user.is_admin %}
- Sharing tags requires at least one group. Create one in
- <a href="/admin#groups" class="text-[var(--text-accent)] hover:underline">Admin&nbsp;&rarr;&nbsp;Groups</a>,
- then come back here to associate this tag with it.
- {% else %}
- Sharing tags requires you to be an admin of at least one group.
- Ask your administrator to create a group and add you as an admin, then you can share tags with that group's members.
- {% endif %}
- </div>
- </div>
- </div>
-
- </div><!-- /.modal-tabs-pane -->
-
- </div>
- <div class="modal-footer">
- <button type="button" id="cancelTagBtn" class="btn btn--ghost" data-i18n="buttons.cancel">Cancel</button>
- <button type="submit" id="saveTagBtn" class="btn btn--primary">
- <i class="fas fa-save"></i><span data-i18n="buttons.createTag">Save Tag</span>
- </button>
- </div>
- </form>
- </div>
- </div>
-
- <!-- Create/Edit Folder Modal -->
- <div id="folderModal" class="modal-overlay hidden">
- <div class="modal-panel modal-panel--md">
- <div class="modal-header">
- <h3 id="folderModalTitle" class="modal-title" data-i18n="folderManagement.createFolderTitle">Create Folder</h3>
- <button id="closeFolderModalBtn" class="modal-close" title="Close"><i class="fas fa-times"></i></button>
- </div>
- <form id="folderForm" style="display: contents;">
- <div class="modal-body space-y-4">
- <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
- <input type="hidden" id="folderId" name="folder_id">
-
- <!-- Name and Color (always visible, outside tabs) -->
- <div>
- <label for="folderName" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.folderName">Folder Name *</label>
- <input type="text" id="folderName" name="name" required maxlength="50" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="e.g., Office Calls, Interviews">
- </div>
-
- <div>
- <label for="folderColor" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.folderColor">Color</label>
- <div class="flex items-center space-x-3">
- <input type="color" id="folderColor" name="color" value="#10B981" class="w-12 h-10 rounded border border-[var(--border-secondary)]">
- <span class="text-sm text-[var(--text-muted)]" data-i18n="folderManagement.colorDescription">Choose a color for easy identification</span>
- </div>
- </div>
-
- <!-- Tab Navigation -->
- <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><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><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><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>
-
- <!-- Tab content area: wrapper keeps modal a consistent height across tabs -->
- <div class="modal-tabs-pane">
-
- <!-- Tab: Transcription & Retention -->
- <div id="folderTabTranscription" class="folder-modal-tab-content space-y-4">
- {% if connector_supports_diarization %}
- <div>
- <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3" data-i18n="folderManagement.transcriptionDefaultSettings">Transcription Default Settings</h4>
- <p class="text-xs text-[var(--text-light)] mb-3" data-i18n="folderManagement.tagPriorityNote">Tag settings take priority over folder settings</p>
- <div class="space-y-3">
- <div>
- <label for="folderLanguage" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="folderManagement.defaultLanguage">Default Language</label>
- <input type="text" id="folderLanguage" name="default_language" maxlength="10" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="e.g., en, es, zh">
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label for="folderMinSpeakers" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="folderManagement.minSpeakers">Min Speakers</label>
- <input type="number" id="folderMinSpeakers" name="default_min_speakers" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- </div>
- <div>
- <label for="folderMaxSpeakers" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="folderManagement.maxSpeakers">Max Speakers</label>
- <input type="number" id="folderMaxSpeakers" name="default_max_speakers" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- </div>
- </div>
- </div>
- </div>
- {% endif %}
-
- <!-- Hotwords & Initial Prompt -->
- {% if connector_supports_hotwords %}
- <div>
- <label for="folderHotwords" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.hotwords">Hotwords</label>
- <input type="text" id="folderHotwords" name="default_hotwords" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" data-i18n-placeholder="form.hotwordsPlaceholder" placeholder="e.g., Speakr, CTranslate2, PyAnnote">
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.hotwordsHelp">Comma-separated words to improve recognition of domain-specific terms</p>
- </div>
- {% endif %}
- {% if connector_supports_initial_prompt %}
- <div>
- <label for="folderInitialPrompt" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.initialPrompt">Initial Prompt</label>
- <select class="ip-template-picker w-full mb-2 px-3 py-2 border border-[var(--border-secondary)] rounded-md text-sm bg-[var(--bg-input)] text-[var(--text-primary)]" data-target="folderInitialPrompt" data-target-hotwords="folderHotwords" style="display:none">
- <option value="">Insert a saved prompt…</option>
- </select>
- <textarea id="folderInitialPrompt" name="default_initial_prompt" rows="2" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" data-i18n-placeholder="form.initialPromptPlaceholder" placeholder="e.g., This is a meeting about AI transcription tools."></textarea>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.initialPromptHelp">Context to steer the transcription model's style and vocabulary</p>
- </div>
- {% endif %}
-
- <!-- Default transcription model (issue #266) — only rendered when admin set TRANSCRIPTION_MODELS_AVAILABLE -->
- <div id="folderTranscriptionModelSection" class="hidden">
- <label for="folderTranscriptionModel" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.defaultTranscriptionModel">Default transcription model</label>
- <select id="folderTranscriptionModel" name="default_transcription_model" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- <option value="" data-i18n="folderManagement.useAdminGlobalDefault">(use admin/global default)</option>
- </select>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.transcriptionModelHelp">Override which transcription model is used for recordings in this folder.</p>
- </div>
-
- <!-- Retention Period Override (only shown when auto-deletion is enabled) -->
- <div id="folderRetentionSection" class="hidden border-t border-[var(--border-primary)] pt-4 mt-2">
- <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3">
- <i class="fas fa-clock mr-2"></i><span data-i18n="folderManagement.retentionAndAutoDeletion">Retention & Auto-Deletion</span>
- </h4>
- <div class="space-y-3">
- <div id="folderRetentionDaysContainer">
- <label for="folderRetentionDays" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.retentionPeriodLabel">Retention Period (days)</label>
- <input type="number" id="folderRetentionDays" name="retention_days" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Leave empty to use global retention" data-i18n-placeholder="folderManagement.retentionPlaceholder">
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.retentionHelp">Leave empty to use global retention period.</p>
- </div>
- <div class="flex items-start space-x-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md">
- <input type="checkbox" id="folderProtectFromDeletion" class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
- <div class="flex-1">
- <label for="folderProtectFromDeletion" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
- <i class="fas fa-shield-alt mr-1 text-yellow-600 dark:text-yellow-400"></i>
- <span data-i18n="folderManagement.protectFromDeletionLabel">Protect from Auto-Deletion (Infinite Retention)</span>
- </label>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.protectFromDeletionLongHelp">Recordings in this folder will never be automatically deleted.</p>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- Tab: Summary & Templates -->
- <div id="folderTabSummary" class="folder-modal-tab-content space-y-4 hidden">
- <div>
- <label for="folderCustomPrompt" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.customPrompt">Custom Summary Prompt</label>
- <textarea id="folderCustomPrompt" name="custom_prompt" rows="4" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Optional: Custom prompt for generating summaries for recordings in this folder" data-i18n-placeholder="folderManagement.summaryPromptPlaceholder"></textarea>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.summaryPromptHelp">Leave blank to use your default summary prompt. Tag prompts take priority over folder prompts.</p>
- </div>
- <div>
- <label for="folderNamingTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.namingTemplate">Naming Template</label>
- <select id="folderNamingTemplate" name="naming_template_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- <option value="" data-i18n="folderManagement.namingTemplateNone">No template (use user default or AI title)</option>
- </select>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.namingTemplateHint">Select a naming template to automatically format titles for recordings in this folder</p>
- </div>
- {% if enable_auto_export %}
- <div>
- <label for="folderExportTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.exportTemplate">Export Template</label>
- <select id="folderExportTemplate" name="export_template_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- <option value="" data-i18n="folderManagement.exportTemplateNone">No template (use user default)</option>
- </select>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.exportTemplateHint">Select an export template to use when exporting recordings in this folder</p>
- </div>
- {% endif %}
- </div>
-
- <!-- Tab: Sharing -->
- <div id="folderTabSharing" class="folder-modal-tab-content space-y-4 hidden">
- <div id="folderGroupSelectionSection" class="hidden">
- <label for="folderGroupId" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.groupAssignment">Group Assignment (Optional)</label>
- <select id="folderGroupId" name="group_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
- <option value="" data-i18n="account.personalFolder">Personal Folder (Not Associated with a Group)</option>
- </select>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.groupAssignmentHelp">Assign this folder to a group to enable auto-sharing when recordings are moved to it</p>
- </div>
- <div id="folderGroupSettingsSection" class="hidden">
- <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3">
- <i class="fas fa-users mr-2"></i><span data-i18n="folderManagement.groupSharingSettings">Group Sharing Settings</span>
- </h4>
- <div class="space-y-3">
- <div class="flex items-start space-x-3">
- <input type="checkbox" id="folderAutoShareOnApply" name="auto_share_on_apply" checked class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
- <div class="flex-1">
- <label for="folderAutoShareOnApply" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
- <i class="fas fa-share-alt mr-1"></i><span data-i18n="folderManagement.autoShareLabel">Auto-share with all group members</span>
- </label>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.autoShareHelp">All group members will automatically get access to recordings in this folder</p>
- </div>
- </div>
- <div class="flex items-start space-x-3">
- <input type="checkbox" id="folderShareWithGroupLead" name="share_with_group_lead" checked class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
- <div class="flex-1">
- <label for="folderShareWithGroupLead" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
- <i class="fas fa-user-shield mr-1"></i><span data-i18n="folderManagement.shareWithAdminsLabel">Share with group admins only</span>
- </label>
- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.shareWithAdminsHelp">Only group admins will get access (not all members)</p>
- </div>
- </div>
- </div>
- <p class="text-xs text-[var(--text-light)] italic mt-3" data-i18n="folderManagement.shareModeNote">Note: If both are enabled, all group members will have access.</p>
- </div>
-
- <!-- Empty state: shown when internal sharing is enabled but the user
- is not an admin of any group (so they can't associate this folder
- with a group). Copy varies by site-admin status. -->
- <div id="folderSharingEmptyState" class="empty hidden">
- <div class="empty__icon"><i class="fas fa-users"></i></div>
- <div class="empty__title" data-i18n="folderManagement.sharingEmptyTitle">No groups available for sharing</div>
- <div class="empty__body">
- {% if current_user.is_admin %}
- Sharing folders requires at least one group. Create one in
- <a href="/admin#groups" class="text-[var(--text-accent)] hover:underline">Admin&nbsp;&rarr;&nbsp;Groups</a>,
- then come back here to associate this folder with it.
- {% else %}
- Sharing folders requires you to be an admin of at least one group.
- Ask your administrator to create a group and add you as an admin, then you can share folders with that group's members.
- {% endif %}
- </div>
- </div>
- </div>
-
- </div><!-- /.modal-tabs-pane -->
- </div><!-- /.modal-body -->
-
- <div class="modal-footer">
- <button type="button" id="cancelFolderBtn" class="btn btn--ghost" data-i18n="buttons.cancel">Cancel</button>
- <button type="submit" id="saveFolderBtn" class="btn btn--primary">
- <i class="fas fa-save mr-2"></i> <span data-i18n="buttons.saveFolder">Save Folder</span>
- </button>
- </div>
- </form>
- </div>
- </div>
+ {% include 'includes/organizer_modals.html' %}
<!-- Create API Token Modal -->
<div id="createTokenModal" class="modal-overlay hidden">
@@ -5590,37 +5140,6 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
}
// Load naming templates for the tag modal dropdown
- // Shared template-dropdown filler for the tag/folder modals.
- // opts.selected sets an explicit value (folder edit); otherwise the
- // select's current value is preserved (tag modal repopulation).
- async function loadTemplateOptionsInto(selectId, url, defaultLabel, opts = {}) {
- const select = document.getElementById(selectId);
- if (!select) return;
- try {
- const response = await fetch(url);
- if (!response.ok) return;
- const templates = await response.json();
- const previous = select.value;
- select.textContent = '';
- const defaultOpt = document.createElement('option');
- defaultOpt.value = '';
- defaultOpt.textContent = defaultLabel;
- select.appendChild(defaultOpt);
- templates.forEach((template) => {
- const option = document.createElement('option');
- option.value = template.id;
- option.textContent = template.name + (opts.markDefault && template.is_default ? ' (Default)' : '');
- if (template.description) option.title = template.description;
- select.appendChild(option);
- });
- const wanted = opts.selected !== undefined && opts.selected !== null
- ? String(opts.selected) : previous;
- if (wanted) select.value = wanted;
- } catch (error) {
- console.error('Error loading template options for ' + selectId + ':', error);
- }
- }
-
// Edit tag
function editTag(tag) {
openTagModal(tag);
@@ -5665,46 +5184,8 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
e.preventDefault();
const formData = new FormData(tagForm);
+ const tagData = window.SpeakrOrganizer.buildTagPayload(tagForm);
- // Determine retention_days: -1 if protected, otherwise use the input value
- const isProtected = document.getElementById('tagProtectFromDeletion')?.checked || false;
- let retentionDays = null;
-
- if (isProtected) {
- retentionDays = -1; // -1 means protected/infinite retention
- } else {
- const retentionInput = formData.get('retention_days');
- retentionDays = retentionInput ? parseInt(retentionInput) : null;
- }
-
- const namingTemplateId = formData.get('naming_template_id');
- const exportTemplateId = formData.get('export_template_id');
- const tagData = {
- name: formData.get('name'),
- color: formData.get('color'),
- custom_prompt: formData.get('custom_prompt') || null,
- naming_template_id: namingTemplateId ? parseInt(namingTemplateId) : null,
- export_template_id: exportTemplateId ? parseInt(exportTemplateId) : null,
- default_language: formData.get('default_language') || null,
- default_min_speakers: formData.get('default_min_speakers') ? parseInt(formData.get('default_min_speakers')) : null,
- default_max_speakers: formData.get('default_max_speakers') ? parseInt(formData.get('default_max_speakers')) : null,
- default_hotwords: formData.get('default_hotwords') || null,
- default_initial_prompt: formData.get('default_initial_prompt') || null,
- default_transcription_model: formData.get('default_transcription_model') || null,
- retention_days: retentionDays,
- is_auto_process: document.getElementById('tagAutoProcess')?.checked || false
- };
-
- // Add group-related fields
- const groupId = formData.get('group_id');
- if (groupId) {
- tagData.group_id = parseInt(groupId);
- tagData.auto_share_on_apply = document.getElementById('tagAutoShareOnApply')?.checked || false;
- tagData.share_with_group_lead = document.getElementById('tagShareWithGroupLead')?.checked || false;
- } else {
- tagData.group_id = null;
- }
-
try {
const csrfToken = document.querySelector('meta[name=csrf-token]')?.getAttribute('content');
@@ -6327,47 +5808,7 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
return;
}
- const folderData = {
- name: folderName,
- color: document.getElementById('folderColor').value,
- custom_prompt: document.getElementById('folderCustomPrompt').value.trim() || null
- };
-
- var langEl = document.getElementById('folderLanguage');
- folderData.default_language = langEl ? langEl.value.trim() || null : null;
- var minEl = document.getElementById('folderMinSpeakers');
- folderData.default_min_speakers = minEl && minEl.value ? parseInt(minEl.value) : null;
- var maxEl = document.getElementById('folderMaxSpeakers');
- folderData.default_max_speakers = maxEl && maxEl.value ? parseInt(maxEl.value) : null;
- var hwEl = document.getElementById('folderHotwords');
- folderData.default_hotwords = hwEl ? hwEl.value.trim() || null : null;
- var ipEl = document.getElementById('folderInitialPrompt');
- folderData.default_initial_prompt = ipEl ? ipEl.value.trim() || null : null;
- var modelEl = document.getElementById('folderTranscriptionModel');
- folderData.default_transcription_model = modelEl ? modelEl.value.trim() || null : null;
- var templateEl = document.getElementById('folderNamingTemplate');
- folderData.naming_template_id = templateEl && templateEl.value ? parseInt(templateEl.value) : null;
- var exportTemplateEl = document.getElementById('folderExportTemplate');
- folderData.export_template_id = exportTemplateEl && exportTemplateEl.value ? parseInt(exportTemplateEl.value) : null;
-
- // Group settings
- const folderGroupIdEl = document.getElementById('folderGroupId');
- if (folderGroupIdEl && folderGroupIdEl.value) {
- folderData.group_id = parseInt(folderGroupIdEl.value);
- var autoShareEl = document.getElementById('folderAutoShareOnApply');
- folderData.auto_share_on_apply = autoShareEl ? autoShareEl.checked : true;
- var shareLeadEl = document.getElementById('folderShareWithGroupLead');
- folderData.share_with_group_lead = shareLeadEl ? shareLeadEl.checked : true;
- }
-
- // Retention settings
- const folderProtect = document.getElementById('folderProtectFromDeletion');
- const folderRetention = document.getElementById('folderRetentionDays');
- if (folderProtect && folderProtect.checked) {
- folderData.retention_days = -1;
- } else if (folderRetention && folderRetention.value) {
- folderData.retention_days = parseInt(folderRetention.value);
- }
+ const folderData = window.SpeakrOrganizer.buildFolderPayload();
try {
const csrfToken = document.querySelector('meta[name=csrf-token]');
diff --git a/templates/components/upload-view.html b/templates/components/upload-view.html
index 4b16bc97..81d5b09b 100644
--- a/templates/components/upload-view.html
+++ b/templates/components/upload-view.html
@@ -537,6 +537,7 @@
<option v-for="folder in availableFolders" :key="folder.id" :value="folder.id">
${ folder.name }
</option>
+ <option value="__create__" v-text="'+ ' + t('form.newFolderOption')"></option>
</select>
<i class="fas fa-folder absolute left-2.5 top-1/2 transform -translate-y-1/2 pointer-events-none"
:style="{ color: selectedFolderId ? getFolderColor(selectedFolderId) : 'var(--text-muted)' }"></i>
@@ -642,6 +643,11 @@
<i class="fas fa-search mr-1" style="font-size: 9px;"></i>
${ t('help.noMatchingTags') }
</p>
+ <button @click="createTagFromUploadSearch"
+ class="mt-1.5 inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded border border-[var(--border-secondary)] hover:border-[var(--border-focus)] bg-[var(--bg-primary)] hover:bg-[var(--bg-secondary)] text-[var(--text-accent)] transition-all">
+ <i class="fas fa-plus" style="font-size: 9px;"></i>
+ <span v-text="uploadTagSearchFilter ? t('help.createTagNamed', { name: uploadTagSearchFilter }) : t('help.newTag')"></span>
+ </button>
</div>
</div>
<!-- Empty States -->
@@ -649,7 +655,7 @@
class="p-2 bg-[var(--bg-tertiary)] rounded-md border border-[var(--border-secondary)]">
<p class="text-xs text-[var(--text-muted)] text-center">
<i class="fas fa-info-circle mr-1" style="font-size: 10px;"></i>
- <span v-text="t('help.noTagsCreated')"></span> <a href="/account#tags" class="text-[var(--text-accent)] hover:underline" v-text="t('help.createTags')"></a>
+ <span v-text="t('help.noTagsCreated')"></span> <button @click="createTagFromUploadSearch" class="text-[var(--text-accent)] hover:underline" v-text="t('help.createTags')"></button>
</p>
</div>
<div v-else class="p-2 bg-[var(--bg-tertiary)] rounded-md border border-[var(--border-secondary)]">
diff --git a/templates/includes/organizer_modals.html b/templates/includes/organizer_modals.html
new file mode 100644
index 00000000..761d1ab7
--- /dev/null
+++ b/templates/includes/organizer_modals.html
@@ -0,0 +1,463 @@
+{# Shared Tag / Folder editor modals.
+
+ Included by account.html (full management: create + edit, driven by the
+ account page's inline script) AND by index.html (inline creation from the
+ upload dialog, driven by static/js/organizer-modals.js in standalone
+ mode). One source of markup so the two pages can never drift.
+
+ The wrapper div carries the admin-group list for the group-assignment
+ dropdown so standalone pages need no extra endpoint. #}
+<div id="organizerModals" data-admin-groups='{{ (user_admin_groups if user_admin_groups is defined else []) | tojson }}'>
+ <div id="tagModal" class="modal-overlay hidden">
+ <div class="modal-panel modal-panel--md">
+ <div class="modal-header">
+ <h3 id="tagModalTitle" class="modal-title" data-i18n="editTagModal.createTitle">Create Tag</h3>
+ <button id="closeTagModalBtn" class="modal-close" title="Close"><i class="fas fa-times"></i></button>
+ </div>
+ <form id="tagForm" style="display: contents;">
+ <div class="modal-body space-y-4">
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
+ <input type="hidden" id="tagId" name="tag_id">
+
+ <!-- Name and Color (always visible, outside tabs) -->
+ <div>
+ <label for="tagName" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.tagName">Tag Name *</label>
+ <input type="text" id="tagName" name="name" required maxlength="50" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="e.g., Meetings, Interviews">
+ </div>
+
+ <div>
+ <label for="tagColor" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.color">Color</label>
+ <div class="flex items-center space-x-3">
+ <input type="color" id="tagColor" name="color" value="#3B82F6" class="w-12 h-10 rounded border border-[var(--border-secondary)]">
+ <span class="text-sm text-[var(--text-muted)]" data-i18n="editTagModal.colorDescription">Choose a color for easy identification</span>
+ </div>
+ </div>
+
+ {% if enable_auto_processing %}
+ <!-- Auto-process watch folder toggle -->
+ <div id="tagAutoProcessRow" class="flex items-center justify-between py-2 px-3 bg-[var(--bg-tertiary)] rounded-md">
+ <div class="flex items-center space-x-2">
+ <i class="fas fa-folder-open text-[var(--text-muted)] text-sm"></i>
+ <label for="tagAutoProcess" class="text-sm font-medium text-[var(--text-secondary)] cursor-pointer" data-i18n="editTagModal.watchFolder">Watch Folder</label>
+ </div>
+ <label class="relative inline-flex items-center cursor-pointer">
+ <input type="checkbox" id="tagAutoProcess" class="sr-only peer">
+ <div class="w-9 h-5 bg-[var(--bg-quaternary)] peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-[var(--border-focus)] rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-[var(--border-secondary)] after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[var(--bg-success)]"></div>
+ </label>
+ </div>
+ <div id="tagAutoProcessPath" class="hidden px-3 py-2 bg-[var(--bg-tertiary)] rounded-md -mt-2">
+ <span class="text-xs text-[var(--text-muted)]" data-i18n="editTagModal.watchFolderPath">Drop files in:</span>
+ <code id="tagAutoProcessPathValue" class="block text-xs text-[var(--text-primary)] font-mono mt-1 break-all"></code>
+ </div>
+ {% endif %}
+
+ <!-- Tab Navigation -->
+ <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<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<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<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>
+
+ <!-- Tab content area: wrapper keeps modal a consistent height across tabs -->
+ <div class="modal-tabs-pane">
+
+ <!-- Tab: Transcription & Retention -->
+ <div id="tagTabTranscription" class="tag-modal-tab-content space-y-4">
+ {% if connector_supports_diarization %}
+ <div>
+ <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3" data-i18n="editTagModal.asrDefaultSettings">Transcription Default Settings</h4>
+ <div class="space-y-3">
+ <div>
+ <label for="tagLanguage" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="editTagModal.defaultLanguage">Default Language</label>
+ <input type="text" id="tagLanguage" name="default_language" maxlength="10" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="e.g., en, es, zh">
+ </div>
+ <div class="grid grid-cols-2 gap-3">
+ <div>
+ <label for="tagMinSpeakers" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="editTagModal.minSpeakers">Min Speakers</label>
+ <input type="number" id="tagMinSpeakers" name="default_min_speakers" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ </div>
+ <div>
+ <label for="tagMaxSpeakers" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="editTagModal.maxSpeakers">Max Speakers</label>
+ <input type="number" id="tagMaxSpeakers" name="default_max_speakers" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ </div>
+ </div>
+ </div>
+ </div>
+ {% endif %}
+
+ <!-- Hotwords & Initial Prompt -->
+ {% if connector_supports_hotwords %}
+ <div>
+ <label for="tagHotwords" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.hotwords">Hotwords</label>
+ <input type="text" id="tagHotwords" name="default_hotwords" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" data-i18n-placeholder="form.hotwordsPlaceholder" placeholder="e.g., Speakr, CTranslate2, PyAnnote">
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.hotwordsHelp">Comma-separated words to improve recognition of domain-specific terms</p>
+ </div>
+ {% endif %}
+ {% if connector_supports_initial_prompt %}
+ <div>
+ <label for="tagInitialPrompt" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.initialPrompt">Initial Prompt</label>
+ <select class="ip-template-picker w-full mb-2 px-3 py-2 border border-[var(--border-secondary)] rounded-md text-sm bg-[var(--bg-input)] text-[var(--text-primary)]" data-target="tagInitialPrompt" data-target-hotwords="tagHotwords" style="display:none">
+ <option value="">Insert a saved prompt…</option>
+ </select>
+ <textarea id="tagInitialPrompt" name="default_initial_prompt" rows="2" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" data-i18n-placeholder="form.initialPromptPlaceholder" placeholder="e.g., This is a meeting about AI transcription tools."></textarea>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.initialPromptHelp">Context to steer the transcription model's style and vocabulary</p>
+ </div>
+ {% endif %}
+
+ <!-- Default transcription model (issue #266) — only rendered when admin set TRANSCRIPTION_MODELS_AVAILABLE -->
+ <div id="tagTranscriptionModelSection" class="hidden">
+ <label for="tagTranscriptionModel" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.defaultTranscriptionModel">Default transcription model</label>
+ <select id="tagTranscriptionModel" name="default_transcription_model" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ <option value="">(use admin/global default)</option>
+ </select>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.defaultTranscriptionModelHelp">Override which transcription model is used for recordings with this tag.</p>
+ </div>
+
+ <!-- Retention Period Override (only shown when auto-deletion is enabled) -->
+ <div id="tagRetentionSection" class="hidden border-t border-[var(--border-primary)] pt-4 mt-2">
+ <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3">
+ <i class="fas fa-clock mr-2"></i>Retention & Auto-Deletion
+ </h4>
+ <div class="space-y-3">
+ <div id="tagRetentionDaysContainer">
+ <label for="tagRetentionDays" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Retention Period (days)</label>
+ <input type="number" id="tagRetentionDays" name="retention_days" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Leave empty to use global retention">
+ <p class="text-xs text-[var(--text-light)] mt-1">Leave empty to use global retention period.</p>
+ </div>
+ <div class="flex items-start space-x-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md">
+ <input type="checkbox" id="tagProtectFromDeletion" class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
+ <div class="flex-1">
+ <label for="tagProtectFromDeletion" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
+ <i class="fas fa-shield-alt mr-1 text-yellow-600 dark:text-yellow-400"></i>
+ Protect from Auto-Deletion (Infinite Retention)
+ </label>
+ <p class="text-xs text-[var(--text-light)] mt-1">Recordings with this tag will never be automatically deleted.</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Tab: Summary & Templates -->
+ <div id="tagTabSummary" class="tag-modal-tab-content space-y-4 hidden">
+ <div>
+ <label for="tagCustomPrompt" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.customPrompt">Custom Summary Prompt</label>
+ <textarea id="tagCustomPrompt" name="custom_prompt" rows="4" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Optional: Custom prompt for generating summaries for recordings with this tag" data-i18n-placeholder="editTagModal.customPromptPlaceholder"></textarea>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="editTagModal.leaveBlankPrompt">Leave blank to use your default summary prompt</p>
+
+ {# Warning when this tag uses placeholder variables AND is configured as a watch-folder (auto-process) tag.
+ Drop-folder ingest has no UI for users to fill values, so placeholders silently substitute to empty strings. #}
+ <div id="tagAutoProcessVariableWarning" class="hidden mt-2 flex items-start gap-2 p-2.5 bg-[var(--bg-warning-light)] border border-[var(--border-warning)] rounded-md text-xs text-[var(--text-warning-strong)]">
+ <i class="fas fa-exclamation-triangle mt-0.5"></i>
+ <span data-i18n="editTagModal.watchFolderVariableWarning">This tag is set up as a watch folder and the prompt contains placeholder variables. Recordings ingested through the auto-process directory have no UI for users to fill those values, so the placeholders will substitute to empty strings on the first summary run. Either remove the placeholders or fill the values via reprocess after upload.</span>
+ </div>
+ </div>
+ <div>
+ <label for="tagNamingTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.namingTemplate">Naming Template</label>
+ <select id="tagNamingTemplate" name="naming_template_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ <option value="" data-i18n="editTagModal.noNamingTemplate">No template (use user default or AI title)</option>
+ </select>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="editTagModal.namingTemplateHint">Select a naming template to automatically format titles for recordings with this tag</p>
+ </div>
+ {% if enable_auto_export %}
+ <div>
+ <label for="tagExportTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.exportTemplate">Export Template</label>
+ <select id="tagExportTemplate" name="export_template_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ <option value="" data-i18n="editTagModal.noExportTemplate">No template (use user default)</option>
+ </select>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="editTagModal.exportTemplateHint">Select an export template to use when exporting recordings with this tag</p>
+ </div>
+ {% endif %}
+ </div>
+
+ <!-- Tab: Sharing -->
+ <div id="tagTabSharing" class="tag-modal-tab-content space-y-4 hidden">
+ <div id="tagGroupSelectionSection" class="hidden">
+ <label for="tagGroupId" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Group Assignment (Optional)</label>
+ <select id="tagGroupId" name="group_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ <option value="" data-i18n="account.personalTag">Personal Tag (Not Associated with a Group)</option>
+ </select>
+ <p class="text-xs text-[var(--text-light)] mt-1">Assign this tag to a group to enable auto-sharing when applied to recordings</p>
+ </div>
+ <div id="tagGroupSettingsSection" class="hidden">
+ <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3">
+ <i class="fas fa-users mr-2"></i>Group Sharing Settings
+ </h4>
+ <div class="space-y-3">
+ <div class="flex items-start space-x-3">
+ <input type="checkbox" id="tagAutoShareOnApply" name="auto_share_on_apply" checked class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
+ <div class="flex-1">
+ <label for="tagAutoShareOnApply" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
+ <i class="fas fa-share-alt mr-1"></i>Auto-share with all group members
+ </label>
+ <p class="text-xs text-[var(--text-light)] mt-1">All group members will automatically get access to recordings with this tag</p>
+ </div>
+ </div>
+ <div class="flex items-start space-x-3">
+ <input type="checkbox" id="tagShareWithGroupLead" name="share_with_group_lead" checked class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
+ <div class="flex-1">
+ <label for="tagShareWithGroupLead" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
+ <i class="fas fa-user-shield mr-1"></i>Share with group admins only
+ </label>
+ <p class="text-xs text-[var(--text-light)] mt-1">Only group admins will get access (not all members)</p>
+ </div>
+ </div>
+ </div>
+ <p class="text-xs text-[var(--text-light)] italic mt-3">Note: If both are enabled, all group members will have access.</p>
+ </div>
+
+ <!-- Empty state: shown when internal sharing is enabled but the user
+ is not an admin of any group (so they can't associate this tag
+ with a group). Copy varies by site-admin status. -->
+ <div id="tagSharingEmptyState" class="empty hidden">
+ <div class="empty__icon"><i class="fas fa-users"></i></div>
+ <div class="empty__title" data-i18n="folderManagement.sharingEmptyTitle">No groups available for sharing</div>
+ <div class="empty__body">
+ {% if current_user.is_admin %}
+ Sharing tags requires at least one group. Create one in
+ <a href="/admin#groups" class="text-[var(--text-accent)] hover:underline">Admin&nbsp;&rarr;&nbsp;Groups</a>,
+ then come back here to associate this tag with it.
+ {% else %}
+ Sharing tags requires you to be an admin of at least one group.
+ Ask your administrator to create a group and add you as an admin, then you can share tags with that group's members.
+ {% endif %}
+ </div>
+ </div>
+ </div>
+
+ </div><!-- /.modal-tabs-pane -->
+
+ </div>
+ <div class="modal-footer">
+ <button type="button" id="cancelTagBtn" class="btn btn--ghost" data-i18n="buttons.cancel">Cancel</button>
+ <button type="submit" id="saveTagBtn" class="btn btn--primary">
+ <i class="fas fa-save"></i><span data-i18n="buttons.createTag">Save Tag</span>
+ </button>
+ </div>
+ </form>
+ </div>
+ </div>
+
+ <!-- Create/Edit Folder Modal -->
+ <div id="folderModal" class="modal-overlay hidden">
+ <div class="modal-panel modal-panel--md">
+ <div class="modal-header">
+ <h3 id="folderModalTitle" class="modal-title" data-i18n="folderManagement.createFolderTitle">Create Folder</h3>
+ <button id="closeFolderModalBtn" class="modal-close" title="Close"><i class="fas fa-times"></i></button>
+ </div>
+ <form id="folderForm" style="display: contents;">
+ <div class="modal-body space-y-4">
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
+ <input type="hidden" id="folderId" name="folder_id">
+
+ <!-- Name and Color (always visible, outside tabs) -->
+ <div>
+ <label for="folderName" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.folderName">Folder Name *</label>
+ <input type="text" id="folderName" name="name" required maxlength="50" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="e.g., Office Calls, Interviews">
+ </div>
+
+ <div>
+ <label for="folderColor" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.folderColor">Color</label>
+ <div class="flex items-center space-x-3">
+ <input type="color" id="folderColor" name="color" value="#10B981" class="w-12 h-10 rounded border border-[var(--border-secondary)]">
+ <span class="text-sm text-[var(--text-muted)]" data-i18n="folderManagement.colorDescription">Choose a color for easy identification</span>
+ </div>
+ </div>
+
+ <!-- Tab Navigation -->
+ <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><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><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><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>
+
+ <!-- Tab content area: wrapper keeps modal a consistent height across tabs -->
+ <div class="modal-tabs-pane">
+
+ <!-- Tab: Transcription & Retention -->
+ <div id="folderTabTranscription" class="folder-modal-tab-content space-y-4">
+ {% if connector_supports_diarization %}
+ <div>
+ <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3" data-i18n="folderManagement.transcriptionDefaultSettings">Transcription Default Settings</h4>
+ <p class="text-xs text-[var(--text-light)] mb-3" data-i18n="folderManagement.tagPriorityNote">Tag settings take priority over folder settings</p>
+ <div class="space-y-3">
+ <div>
+ <label for="folderLanguage" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="folderManagement.defaultLanguage">Default Language</label>
+ <input type="text" id="folderLanguage" name="default_language" maxlength="10" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="e.g., en, es, zh">
+ </div>
+ <div class="grid grid-cols-2 gap-3">
+ <div>
+ <label for="folderMinSpeakers" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="folderManagement.minSpeakers">Min Speakers</label>
+ <input type="number" id="folderMinSpeakers" name="default_min_speakers" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ </div>
+ <div>
+ <label for="folderMaxSpeakers" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="folderManagement.maxSpeakers">Max Speakers</label>
+ <input type="number" id="folderMaxSpeakers" name="default_max_speakers" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ </div>
+ </div>
+ </div>
+ </div>
+ {% endif %}
+
+ <!-- Hotwords & Initial Prompt -->
+ {% if connector_supports_hotwords %}
+ <div>
+ <label for="folderHotwords" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.hotwords">Hotwords</label>
+ <input type="text" id="folderHotwords" name="default_hotwords" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" data-i18n-placeholder="form.hotwordsPlaceholder" placeholder="e.g., Speakr, CTranslate2, PyAnnote">
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.hotwordsHelp">Comma-separated words to improve recognition of domain-specific terms</p>
+ </div>
+ {% endif %}
+ {% if connector_supports_initial_prompt %}
+ <div>
+ <label for="folderInitialPrompt" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.initialPrompt">Initial Prompt</label>
+ <select class="ip-template-picker w-full mb-2 px-3 py-2 border border-[var(--border-secondary)] rounded-md text-sm bg-[var(--bg-input)] text-[var(--text-primary)]" data-target="folderInitialPrompt" data-target-hotwords="folderHotwords" style="display:none">
+ <option value="">Insert a saved prompt…</option>
+ </select>
+ <textarea id="folderInitialPrompt" name="default_initial_prompt" rows="2" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" data-i18n-placeholder="form.initialPromptPlaceholder" placeholder="e.g., This is a meeting about AI transcription tools."></textarea>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="form.initialPromptHelp">Context to steer the transcription model's style and vocabulary</p>
+ </div>
+ {% endif %}
+
+ <!-- Default transcription model (issue #266) — only rendered when admin set TRANSCRIPTION_MODELS_AVAILABLE -->
+ <div id="folderTranscriptionModelSection" class="hidden">
+ <label for="folderTranscriptionModel" class="block text-sm font-medium text-[var(--text-muted)] mb-1" data-i18n="form.defaultTranscriptionModel">Default transcription model</label>
+ <select id="folderTranscriptionModel" name="default_transcription_model" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ <option value="" data-i18n="folderManagement.useAdminGlobalDefault">(use admin/global default)</option>
+ </select>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.transcriptionModelHelp">Override which transcription model is used for recordings in this folder.</p>
+ </div>
+
+ <!-- Retention Period Override (only shown when auto-deletion is enabled) -->
+ <div id="folderRetentionSection" class="hidden border-t border-[var(--border-primary)] pt-4 mt-2">
+ <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3">
+ <i class="fas fa-clock mr-2"></i><span data-i18n="folderManagement.retentionAndAutoDeletion">Retention & Auto-Deletion</span>
+ </h4>
+ <div class="space-y-3">
+ <div id="folderRetentionDaysContainer">
+ <label for="folderRetentionDays" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.retentionPeriodLabel">Retention Period (days)</label>
+ <input type="number" id="folderRetentionDays" name="retention_days" min="1" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Leave empty to use global retention" data-i18n-placeholder="folderManagement.retentionPlaceholder">
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.retentionHelp">Leave empty to use global retention period.</p>
+ </div>
+ <div class="flex items-start space-x-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md">
+ <input type="checkbox" id="folderProtectFromDeletion" class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
+ <div class="flex-1">
+ <label for="folderProtectFromDeletion" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
+ <i class="fas fa-shield-alt mr-1 text-yellow-600 dark:text-yellow-400"></i>
+ <span data-i18n="folderManagement.protectFromDeletionLabel">Protect from Auto-Deletion (Infinite Retention)</span>
+ </label>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.protectFromDeletionLongHelp">Recordings in this folder will never be automatically deleted.</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Tab: Summary & Templates -->
+ <div id="folderTabSummary" class="folder-modal-tab-content space-y-4 hidden">
+ <div>
+ <label for="folderCustomPrompt" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.customPrompt">Custom Summary Prompt</label>
+ <textarea id="folderCustomPrompt" name="custom_prompt" rows="4" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Optional: Custom prompt for generating summaries for recordings in this folder" data-i18n-placeholder="folderManagement.summaryPromptPlaceholder"></textarea>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.summaryPromptHelp">Leave blank to use your default summary prompt. Tag prompts take priority over folder prompts.</p>
+ </div>
+ <div>
+ <label for="folderNamingTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.namingTemplate">Naming Template</label>
+ <select id="folderNamingTemplate" name="naming_template_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ <option value="" data-i18n="folderManagement.namingTemplateNone">No template (use user default or AI title)</option>
+ </select>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.namingTemplateHint">Select a naming template to automatically format titles for recordings in this folder</p>
+ </div>
+ {% if enable_auto_export %}
+ <div>
+ <label for="folderExportTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.exportTemplate">Export Template</label>
+ <select id="folderExportTemplate" name="export_template_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ <option value="" data-i18n="folderManagement.exportTemplateNone">No template (use user default)</option>
+ </select>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.exportTemplateHint">Select an export template to use when exporting recordings in this folder</p>
+ </div>
+ {% endif %}
+ </div>
+
+ <!-- Tab: Sharing -->
+ <div id="folderTabSharing" class="folder-modal-tab-content space-y-4 hidden">
+ <div id="folderGroupSelectionSection" class="hidden">
+ <label for="folderGroupId" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="folderManagement.groupAssignment">Group Assignment (Optional)</label>
+ <select id="folderGroupId" name="group_id" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">
+ <option value="" data-i18n="account.personalFolder">Personal Folder (Not Associated with a Group)</option>
+ </select>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.groupAssignmentHelp">Assign this folder to a group to enable auto-sharing when recordings are moved to it</p>
+ </div>
+ <div id="folderGroupSettingsSection" class="hidden">
+ <h4 class="text-sm font-medium text-[var(--text-secondary)] mb-3">
+ <i class="fas fa-users mr-2"></i><span data-i18n="folderManagement.groupSharingSettings">Group Sharing Settings</span>
+ </h4>
+ <div class="space-y-3">
+ <div class="flex items-start space-x-3">
+ <input type="checkbox" id="folderAutoShareOnApply" name="auto_share_on_apply" checked class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
+ <div class="flex-1">
+ <label for="folderAutoShareOnApply" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
+ <i class="fas fa-share-alt mr-1"></i><span data-i18n="folderManagement.autoShareLabel">Auto-share with all group members</span>
+ </label>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.autoShareHelp">All group members will automatically get access to recordings in this folder</p>
+ </div>
+ </div>
+ <div class="flex items-start space-x-3">
+ <input type="checkbox" id="folderShareWithGroupLead" name="share_with_group_lead" checked class="mt-1 h-4 w-4 text-[var(--bg-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)]">
+ <div class="flex-1">
+ <label for="folderShareWithGroupLead" class="block text-sm font-medium text-[var(--text-secondary)] cursor-pointer">
+ <i class="fas fa-user-shield mr-1"></i><span data-i18n="folderManagement.shareWithAdminsLabel">Share with group admins only</span>
+ </label>
+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="folderManagement.shareWithAdminsHelp">Only group admins will get access (not all members)</p>
+ </div>
+ </div>
+ </div>
+ <p class="text-xs text-[var(--text-light)] italic mt-3" data-i18n="folderManagement.shareModeNote">Note: If both are enabled, all group members will have access.</p>
+ </div>
+
+ <!-- Empty state: shown when internal sharing is enabled but the user
+ is not an admin of any group (so they can't associate this folder
+ with a group). Copy varies by site-admin status. -->
+ <div id="folderSharingEmptyState" class="empty hidden">
+ <div class="empty__icon"><i class="fas fa-users"></i></div>
+ <div class="empty__title" data-i18n="folderManagement.sharingEmptyTitle">No groups available for sharing</div>
+ <div class="empty__body">
+ {% if current_user.is_admin %}
+ Sharing folders requires at least one group. Create one in
+ <a href="/admin#groups" class="text-[var(--text-accent)] hover:underline">Admin&nbsp;&rarr;&nbsp;Groups</a>,
+ then come back here to associate this folder with it.
+ {% else %}
+ Sharing folders requires you to be an admin of at least one group.
+ Ask your administrator to create a group and add you as an admin, then you can share folders with that group's members.
+ {% endif %}
+ </div>
+ </div>
+ </div>
+
+ </div><!-- /.modal-tabs-pane -->
+ </div><!-- /.modal-body -->
+
+ <div class="modal-footer">
+ <button type="button" id="cancelFolderBtn" class="btn btn--ghost" data-i18n="buttons.cancel">Cancel</button>
+ <button type="submit" id="saveFolderBtn" class="btn btn--primary">
+ <i class="fas fa-save mr-2"></i> <span data-i18n="buttons.saveFolder">Save Folder</span>
+ </button>
+ </div>
+ </form>
+ </div>
+ </div>
+</div><!-- /organizerModals -->
diff --git a/templates/index.html b/templates/index.html
index e7ed7c66..eba051d5 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -182,6 +182,9 @@
{% include 'modals/bulk-merge-modal.html' %}
</div>
+ <!-- Shared tag/folder editor modals (outside the Vue root; driven by organizer-modals.js) -->
+ {% include 'includes/organizer_modals.html' %}
+
<!-- CSRF Token Management -->
<script src="{{ url_for('static', filename='js/csrf-refresh.js') }}"></script>
@@ -225,6 +228,9 @@
<!-- Service Worker Registration handled by app.modular.js -->
+ <!-- Shared tag/folder modal driver (standalone creation mode) -->
+ <script src="{{ url_for('static', filename='js/organizer-modals.js') }}"></script>
+
<!-- Vue.js Application Script -->
<script type="module" src="{{ url_for('static', filename='js/app.modular.js') }}"></script>
</body>