mirror of
https://github.com/trevor1969/teatracker.git
synced 2026-08-09 10:41:59 +00:00
Compare commits
6 Commits
233647be4a
...
v1.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 733e2db3c4 | |||
| 30e0077c6e | |||
| 7b9f509728 | |||
| 6addc628e8 | |||
| 58e2a70201 | |||
| b3c1041792 |
32
app.js
32
app.js
@ -778,6 +778,30 @@ class TeeTracker {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load existing data from localStorage before switching to Nextcloud
|
||||
// This prevents data loss when connecting to Nextcloud for the first time
|
||||
const existingTeas = localStorage.getItem(STORAGE_KEY_TEAS);
|
||||
const existingEntries = localStorage.getItem(STORAGE_KEY_ENTRIES);
|
||||
|
||||
if (existingTeas) {
|
||||
try {
|
||||
this.teas = JSON.parse(existingTeas).map(tea => ({
|
||||
...tea,
|
||||
organic: tea.organic !== undefined ? tea.organic : false
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('Error loading existing teas:', error);
|
||||
}
|
||||
}
|
||||
|
||||
if (existingEntries) {
|
||||
try {
|
||||
this.entries = JSON.parse(existingEntries);
|
||||
} catch (error) {
|
||||
console.error('Error loading existing entries:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Save config WITHOUT password for security
|
||||
// Password will be requested each time or stored in sessionStorage
|
||||
const config = { baseUrl: url, username, path };
|
||||
@ -1071,8 +1095,8 @@ class TeeTracker {
|
||||
${tea.brand ? `<div class="tea-brand">Marke: ${tea.brand}</div>` : ''}
|
||||
${tea.description ? `<div class="tea-description">${tea.description}</div>` : ''}
|
||||
<div class="tea-actions">
|
||||
<button class="tea-action-btn tea-edit-btn" onclick="app.editTea('${tea.id}')">Bearbeiten</button>
|
||||
<button class="tea-action-btn tea-delete-btn" onclick="app.showDeleteTeaConfirm('${tea.id}')">Löschen</button>
|
||||
<button class="tea-action-btn tea-edit-btn" onclick="window.app.editTea('${tea.id}')">Bearbeiten</button>
|
||||
<button class="tea-action-btn tea-delete-btn" onclick="window.app.showDeleteTeaConfirm('${tea.id}')">Löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
@ -1115,8 +1139,8 @@ class TeeTracker {
|
||||
${tea.brand ? `<div class="tea-brand">Marke: ${tea.brand}</div>` : ''}
|
||||
${tea.description ? `<div class="tea-description">${tea.description}</div>` : ''}
|
||||
<div class="tea-actions">
|
||||
<button class="tea-action-btn tea-edit-btn" onclick="app.editTea('${tea.id}')">Bearbeiten</button>
|
||||
<button class="tea-action-btn tea-delete-btn" onclick="app.showDeleteTeaConfirm('${tea.id}')">Löschen</button>
|
||||
<button class="tea-action-btn tea-edit-btn" onclick="window.app.editTea('${tea.id}')">Bearbeiten</button>
|
||||
<button class="tea-action-btn tea-delete-btn" onclick="window.app.showDeleteTeaConfirm('${tea.id}')">Löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
@ -327,8 +327,8 @@
|
||||
<textarea id="import-data-textarea" class="modal-textarea" placeholder="{\n \"teas\": [...],\n \"entries\": [...]\n}"></textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="import-data-btn" class="btn btn-primary" onclick="app.handleImportData()">📥 Importieren</button>
|
||||
<button id="cancel-import-btn" class="btn btn-secondary" onclick="app.closeImportModal()">Abbrechen</button>
|
||||
<button id="import-data-btn" class="btn btn-primary" onclick="window.app.handleImportData()">📥 Importieren</button>
|
||||
<button id="cancel-import-btn" class="btn btn-secondary" onclick="window.app.closeImportModal()">Abbrechen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user