Foto del profilo: uno schema dei nomi proprio (#38)
Alberto ha deciso che le foto del profilo stanno dentro ogni account, in
<account>\profilo. Con un solo schema generale bastava cambiarlo perché
finissero insieme ai post: ora hanno il loro schema, come le raccolte in
evidenza, predefinito {account}\profilo\{data}_{ora}_{codice}_{n}, senza la
cartella dell'anno.
Impostazioni > Generali mostra il terzo campo con la cartella nel risultato
e colora solo il campo sbagliato. Un salvataggio che non manda il terzo
schema tiene quello salvato. Importazione e ricostruzione del database
riconoscono la cartella; prove nuove per nomi, impostazioni, salvataggio,
importazione e ricostruzione. Schermata confrontata con il mockup 08.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
305791f57b
commit
72deb212a7
19 files changed
+340
-69
No files matched your search
@@ -1,5 +1,5 @@
|
||||
// Impostazioni, Generali (mockup 08, spec §4.7, §10.5, §12): the Libreria and Dati folders with «Cambia…» (desktop:
|
||||
// native picker; Docker: read-only with the note), free and used space; the two naming schemes with the live «Risultato»
|
||||
// native picker; Docker: read-only with the note), free and used space; the three naming schemes with the live «Risultato»
|
||||
// tree, the placeholders and the errors; «Imposta la data del file a quella di pubblicazione»; theme and language;
|
||||
// the «Avvio» block on Windows only.
|
||||
|
||||
@@ -12,9 +12,10 @@ import { guardChanges, heading } from './settings.js';
|
||||
|
||||
export default async function general(page, box) {
|
||||
let data = await api('/api/settings/general', { signal: page.signal });
|
||||
let saved = { naming: data.namingScheme, highlight: data.highlightScheme, setFileTime: data.setFileTime };
|
||||
const stored = (d) => ({ naming: d.namingScheme, highlight: d.highlightScheme, profile: d.profilePictureScheme, setFileTime: d.setFileTime });
|
||||
let saved = stored(data);
|
||||
const form = { ...saved };
|
||||
const dirty = () => form.naming !== saved.naming || form.highlight !== saved.highlight || form.setFileTime !== saved.setFileTime;
|
||||
const dirty = () => Object.keys(saved).some((key) => form[key] !== saved[key]);
|
||||
guardChanges(page, dirty);
|
||||
|
||||
// ------------------------------------------------------------------------------------------- folders
|
||||
@@ -86,6 +87,7 @@ export default async function general(page, box) {
|
||||
libraryFolder: null,
|
||||
namingScheme: withForm ? form.naming : saved.naming,
|
||||
highlightScheme: withForm ? form.highlight : saved.highlight,
|
||||
profilePictureScheme: withForm ? form.profile : saved.profile,
|
||||
setFileTime: withForm ? form.setFileTime : saved.setFileTime,
|
||||
autostart: null,
|
||||
keepInTray: null,
|
||||
@@ -93,7 +95,7 @@ export default async function general(page, box) {
|
||||
};
|
||||
try {
|
||||
data = await api('/api/settings/general', { method: 'PUT', body });
|
||||
saved = { naming: data.namingScheme, highlight: data.highlightScheme, setFileTime: data.setFileTime };
|
||||
saved = stored(data);
|
||||
if (withForm) Object.assign(form, saved);
|
||||
drawFolders();
|
||||
drawSaveBar();
|
||||
@@ -108,16 +110,20 @@ export default async function general(page, box) {
|
||||
// ------------------------------------------------------------------------------------------- naming
|
||||
const naming = h('input.dati', { type: 'text', value: form.naming, id: 'schema', spellcheck: 'false', autocomplete: 'off' });
|
||||
const highlight = h('input.dati', { type: 'text', value: form.highlight, id: 'schema-evidenza', spellcheck: 'false', autocomplete: 'off' });
|
||||
const profile = h('input.dati', { type: 'text', value: form.profile, id: 'schema-profilo', spellcheck: 'false', autocomplete: 'off' });
|
||||
const namingField = h('label.campo', naming);
|
||||
const highlightField = h('label.campo', highlight);
|
||||
const profileField = h('label.campo', profile);
|
||||
const problems = h('div.problemi-schema', { 'aria-live': 'polite' });
|
||||
const tree = h('div.albero.pannello', { 'aria-label': t('impostazioni.generali.risultato') });
|
||||
const setTime = checkbox({ checked: form.setFileTime, label: t('impostazioni.generali.dataFile'), onchange: (v) => { form.setFileTime = v; drawSaveBar(); } });
|
||||
|
||||
function drawTree(preview) {
|
||||
const errors = preview.errors || [];
|
||||
// Each error starts with the name of its scheme (NamingPreview.Prefix).
|
||||
namingField.classList.toggle('errore', errors.some((e) => e.startsWith('Schema:')));
|
||||
highlightField.classList.toggle('errore', errors.some((e) => !e.startsWith('Schema:')));
|
||||
highlightField.classList.toggle('errore', errors.some((e) => e.startsWith('Schema per le raccolte in evidenza:')));
|
||||
profileField.classList.toggle('errore', errors.some((e) => e.startsWith('Schema per le foto del profilo:')));
|
||||
fill(problems,
|
||||
errors.map((e) => h('p.errore-testo', icon('octagon-alert', 'xs'), ' ', e)),
|
||||
(preview.warnings || []).map((w) => h('p.avviso-testo', icon('triangle-alert', 'xs'), ' ', w)));
|
||||
@@ -131,7 +137,7 @@ export default async function general(page, box) {
|
||||
|
||||
const refresh = later(async () => {
|
||||
try {
|
||||
drawTree(await api('/api/settings/naming-preview', { method: 'POST', body: { namingScheme: form.naming, highlightScheme: form.highlight }, signal: page.signal }));
|
||||
drawTree(await api('/api/settings/naming-preview', { method: 'POST', body: { namingScheme: form.naming, highlightScheme: form.highlight, profilePictureScheme: form.profile }, signal: page.signal }));
|
||||
} catch (error) {
|
||||
if (error.name !== 'AbortError') showError(error);
|
||||
}
|
||||
@@ -139,6 +145,7 @@ export default async function general(page, box) {
|
||||
page.onLeave(() => refresh.cancel());
|
||||
naming.addEventListener('input', () => { form.naming = naming.value; drawSaveBar(); refresh(); });
|
||||
highlight.addEventListener('input', () => { form.highlight = highlight.value; drawSaveBar(); refresh(); });
|
||||
profile.addEventListener('input', () => { form.profile = profile.value; drawSaveBar(); refresh(); });
|
||||
|
||||
// ------------------------------------------------------------------------------------------- save bar
|
||||
function drawSaveBar() {
|
||||
@@ -157,6 +164,7 @@ export default async function general(page, box) {
|
||||
Object.assign(form, saved);
|
||||
naming.value = form.naming;
|
||||
highlight.value = form.highlight;
|
||||
profile.value = form.profile;
|
||||
setTime.input.checked = form.setFileTime;
|
||||
drawSaveBar();
|
||||
refresh();
|
||||
@@ -197,6 +205,7 @@ export default async function general(page, box) {
|
||||
h('div.colonna-nomi',
|
||||
h('label.etichetta', { for: 'schema' }, t('impostazioni.generali.schema')), namingField,
|
||||
h('label.etichetta', { for: 'schema-evidenza' }, t('impostazioni.generali.schemaEvidenza')), highlightField,
|
||||
h('label.etichetta', { for: 'schema-profilo' }, t('impostazioni.generali.schemaProfilo')), profileField,
|
||||
h('p.aiuto.segnaposto', t('impostazioni.generali.segnaposto', { elenco: data.placeholders.join(', ') })),
|
||||
problems,
|
||||
h('div.data-file', setTime)),
|
||||
|
||||
@@ -574,6 +574,7 @@
|
||||
"nomiAiuto": "Vale per i prossimi download: i file già salvati non vengono rinominati.",
|
||||
"schema": "Schema",
|
||||
"schemaEvidenza": "Schema per le raccolte in evidenza",
|
||||
"schemaProfilo": "Schema per le foto del profilo",
|
||||
"risultato": "Risultato",
|
||||
"segnaposto": "Segnaposto: {elenco}.",
|
||||
"dataFile": "Imposta la data del file a quella di pubblicazione",
|
||||
|
||||
Reference in new issue
Block a user