Fix: Mehrfachauswahl bei Routen-Fotos (multiple attribute + loop)
This commit is contained in:
parent
3144e100f3
commit
9ba78f3b16
2 changed files with 10 additions and 9 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '227'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '228'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
|
|
||||||
const App = (() => {
|
const App = (() => {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -705,12 +705,12 @@ window.Page_routes = (() => {
|
||||||
${photos.map(u => `<img src="${UI.escape(u)}" class="rk-photo-thumb" onclick="window.open('${UI.escape(u)}','_blank')">`).join('')}
|
${photos.map(u => `<img src="${UI.escape(u)}" class="rk-photo-thumb" onclick="window.open('${UI.escape(u)}','_blank')">`).join('')}
|
||||||
${isOwn ? `<label class="rk-photo-add" title="Foto hinzufügen">
|
${isOwn ? `<label class="rk-photo-add" title="Foto hinzufügen">
|
||||||
<span>+</span>
|
<span>+</span>
|
||||||
<input type="file" id="rk-photo-input" accept="image/*" style="display:none">
|
<input type="file" id="rk-photo-input" accept="image/*" multiple style="display:none">
|
||||||
</label>` : ''}
|
</label>` : ''}
|
||||||
</div>` :
|
</div>` :
|
||||||
isOwn ? `<label class="rk-photo-add-empty">
|
isOwn ? `<label class="rk-photo-add-empty">
|
||||||
${UI.icon('camera')} Foto hinzufügen
|
${UI.icon('camera')} Foto hinzufügen
|
||||||
<input type="file" id="rk-photo-input" accept="image/*" style="display:none">
|
<input type="file" id="rk-photo-input" accept="image/*" multiple style="display:none">
|
||||||
</label>` : '';
|
</label>` : '';
|
||||||
|
|
||||||
const body = `
|
const body = `
|
||||||
|
|
@ -853,13 +853,14 @@ window.Page_routes = (() => {
|
||||||
|
|
||||||
// Foto-Upload
|
// Foto-Upload
|
||||||
document.getElementById('rk-photo-input')?.addEventListener('change', async e => {
|
document.getElementById('rk-photo-input')?.addEventListener('change', async e => {
|
||||||
const file = e.target.files?.[0];
|
const files = Array.from(e.target.files || []);
|
||||||
if (!file) return;
|
if (!files.length) return;
|
||||||
try {
|
try {
|
||||||
const res = await API.routes.addPhoto(route.id, file);
|
for (const file of files) {
|
||||||
route.foto_urls = res.foto_urls;
|
const res = await API.routes.addPhoto(route.id, file);
|
||||||
UI.toast.success('Foto gespeichert!');
|
route.foto_urls = res.foto_urls;
|
||||||
// Reload detail
|
}
|
||||||
|
UI.toast.success(files.length > 1 ? `${files.length} Fotos gespeichert!` : 'Foto gespeichert!');
|
||||||
UI.modal.close();
|
UI.modal.close();
|
||||||
setTimeout(() => _openDetail(route.id), 200);
|
setTimeout(() => _openDetail(route.id), 200);
|
||||||
} catch (err) { UI.toast.error(err.message); }
|
} catch (err) { UI.toast.error(err.message); }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue