Simplify tags: free text only, no categories

Remove type system (ambiance/epoque/rythme/genre/theme).
Tags are now plain strings. Old format auto-migrated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Etienne Delvarre
2026-05-29 12:56:45 +02:00
parent 1f0087c73b
commit a4cde29a9e
+7 -7
View File
@@ -1074,19 +1074,19 @@ function setupEditable(elId, section) {
}
// ── Tags ──
const TAG_TYPES = ['ambiance', 'epoque', 'rythme', 'genre', 'theme'];
function renderTags() {
const container = document.getElementById('v-tags');
const row = visionData['tags'];
let tags = [];
try { tags = JSON.parse(row?.Contenu || '[]'); } catch { tags = []; }
// Normalize: old format {label, type} → just strings
tags = tags.map(t => typeof t === 'string' ? t : t.label || '');
container.innerHTML = '';
tags.forEach((t, i) => {
tags.forEach((label, i) => {
const span = document.createElement('span');
span.className = `tag ${t.type || 'ambiance'}`;
span.innerHTML = `${esc(t.label)}<span class="tag-remove" onclick="removeTag(${i})">&times;</span>`;
span.className = 'tag ambiance';
span.innerHTML = `${esc(label)}<span class="tag-remove" onclick="removeTag(${i})">&times;</span>`;
container.appendChild(span);
});
@@ -1096,8 +1096,7 @@ function renderTags() {
addBtn.onclick = () => {
const label = prompt('Nouveau tag :');
if (!label) return;
const type = prompt('Type (ambiance, epoque, rythme, genre, theme) :', 'genre') || 'genre';
tags.push({ label, type });
tags.push(label);
saveVisionSection('tags', JSON.stringify(tags));
renderTags();
};
@@ -1108,6 +1107,7 @@ function removeTag(index) {
const row = visionData['tags'];
let tags = [];
try { tags = JSON.parse(row?.Contenu || '[]'); } catch { return; }
tags = tags.map(t => typeof t === 'string' ? t : t.label || '');
tags.splice(index, 1);
saveVisionSection('tags', JSON.stringify(tags));
renderTags();