feat: Einstellungen in Kapitel (Profil/Darstellung/Ansicht/Kalender)
- Settings-Sidebar mit Kapiteln: Profil, Darstellung, Ansicht, Kalender, Benutzerverwaltung (statt eines langen "Darstellung"-Panels). - Neues "Profil"-Kapitel: Anzeigename + Login-Name ändern, E-Mail, plus Privatsphäre (private Sichtbarkeit) und "Für Gruppen sichtbarer Kalender". - "Konten" → "Kalender" umbenannt. Version v39. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2553,6 +2553,14 @@ function openSettingsModal() {
|
||||
document.getElementById('cfg-private-visibility').value = s.private_event_visibility || 'busy';
|
||||
renderGroupVisibleList(s.group_visible_calendar_id);
|
||||
|
||||
// Profile chapter: name (from cached user) + email (fresh from /profile).
|
||||
const pu = JSON.parse(localStorage.getItem('user') || '{}');
|
||||
document.getElementById('cfg-display-name').value = pu.display_name || pu.username || '';
|
||||
document.getElementById('cfg-login-name').value = pu.username || '';
|
||||
api.get('/profile/').then(p => {
|
||||
document.getElementById('cfg-email').value = p.email || '';
|
||||
}).catch(() => {});
|
||||
|
||||
// Set active contrast/hour-height buttons
|
||||
[
|
||||
{ id: 'cfg-text-contrast', val: s.text_contrast || 3 },
|
||||
@@ -3003,6 +3011,29 @@ function bindSettingsModal() {
|
||||
} catch (e) { showToast(e.message, true); }
|
||||
};
|
||||
|
||||
// Profile chapter save (name/login/email → /profile, separate from settings).
|
||||
const profileSaveBtn = document.getElementById('cfg-profile-save');
|
||||
if (profileSaveBtn) profileSaveBtn.onclick = async () => {
|
||||
const email = document.getElementById('cfg-email').value.trim();
|
||||
const displayName = document.getElementById('cfg-display-name').value.trim();
|
||||
const loginName = document.getElementById('cfg-login-name').value.trim();
|
||||
const user = JSON.parse(localStorage.getItem('user') || '{}');
|
||||
const body = { email: email || null };
|
||||
if (displayName) body.display_name = displayName;
|
||||
if (loginName && loginName.toLowerCase() !== (user.username || '')) body.username = loginName;
|
||||
try {
|
||||
const res = await api.put('/profile/', body);
|
||||
if (res && res.access_token) localStorage.setItem('token', res.access_token);
|
||||
const updated = { ...user };
|
||||
if (displayName) updated.display_name = displayName;
|
||||
if (body.username) updated.username = body.username.toLowerCase();
|
||||
localStorage.setItem('user', JSON.stringify(updated));
|
||||
const dd = document.getElementById('dropdown-username');
|
||||
if (dd) dd.textContent = updated.display_name || updated.username || 'Benutzer';
|
||||
showToast(t('profile_saved'));
|
||||
} catch (e) { showToast(e.message, true); }
|
||||
};
|
||||
|
||||
document.getElementById('settings-save').onclick = async () => {
|
||||
const getActive = (id) => {
|
||||
const btn = document.querySelector(`#${id} .contrast-btn.active`);
|
||||
|
||||
@@ -60,6 +60,9 @@ const translations = {
|
||||
// Settings
|
||||
settings_title: 'Einstellungen',
|
||||
settings_nav_appearance: 'Darstellung',
|
||||
settings_nav_profile: 'Profil',
|
||||
settings_nav_view: 'Ansicht',
|
||||
settings_nav_calendars: 'Kalender',
|
||||
settings_nav_google: 'Google Konten',
|
||||
settings_nav_users: 'Benutzerverwaltung',
|
||||
settings_colors: 'Farben',
|
||||
@@ -329,6 +332,9 @@ const translations = {
|
||||
// Settings
|
||||
settings_title: 'Settings',
|
||||
settings_nav_appearance: 'Appearance',
|
||||
settings_nav_profile: 'Profile',
|
||||
settings_nav_view: 'View',
|
||||
settings_nav_calendars: 'Calendars',
|
||||
settings_nav_google: 'Google Accounts',
|
||||
settings_nav_users: 'User Management',
|
||||
settings_colors: 'Colors',
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Increment APP_VERSION with every code change
|
||||
export const APP_VERSION = 'v38';
|
||||
export const APP_VERSION = 'v39';
|
||||
|
||||
Reference in New Issue
Block a user