This commit is contained in:
+10
-2
@@ -142,7 +142,7 @@
|
|||||||
|
|
||||||
.route-control-actions {
|
.route-control-actions {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: auto minmax(0, 1fr);
|
||||||
gap: .5rem;
|
gap: .5rem;
|
||||||
margin-top: .85rem;
|
margin-top: .85rem;
|
||||||
padding-top: .75rem;
|
padding-top: .75rem;
|
||||||
@@ -171,7 +171,15 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-weight: 700;
|
min-height: 2.75rem;
|
||||||
|
min-width: 2.75rem;
|
||||||
|
padding: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-button-icon {
|
||||||
|
display: block;
|
||||||
|
height: 1.65rem;
|
||||||
|
width: 1.65rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-media-actions {
|
.editor-media-actions {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none">
|
||||||
|
<path d="M11 29 14.2 3h3.6L21 29" stroke="white" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16 5v4m0 4v4m0 4v4" stroke="white" stroke-width="2.2" stroke-linecap="round"/>
|
||||||
|
<path d="M7 29h18" stroke="white" stroke-width="2.8" stroke-linecap="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 370 B |
+3
-1
@@ -140,7 +140,9 @@
|
|||||||
<ul id="route-control-local-list" class="route-control-list" aria-live="polite"></ul>
|
<ul id="route-control-local-list" class="route-control-list" aria-live="polite"></ul>
|
||||||
</section>
|
</section>
|
||||||
<div class="route-control-actions">
|
<div class="route-control-actions">
|
||||||
<button id="editor-button" class="editor-button" type="button" title="Streckenverwaltung öffnen" aria-haspopup="dialog" aria-expanded="false" aria-controls="editor-dialog">Strecken verwalten</button>
|
<button id="editor-button" class="editor-button" type="button" aria-label="Streckenverwaltung öffnen" title="Streckenverwaltung öffnen" aria-haspopup="dialog" aria-expanded="false" aria-controls="editor-dialog">
|
||||||
|
<img class="editor-button-icon" src="images/icons/route-management.svg" alt="" aria-hidden="true">
|
||||||
|
</button>
|
||||||
<button id="route-control-new" class="editor-primary-button" type="button">Neue lokale Strecke</button>
|
<button id="route-control-new" class="editor-primary-button" type="button">Neue lokale Strecke</button>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -336,7 +336,9 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
|||||||
const actions = document.createElement('div');
|
const actions = document.createElement('div');
|
||||||
actions.className = classes.iconRow;
|
actions.className = classes.iconRow;
|
||||||
actions.appendChild(iconButton('Strecke bearbeiten', '✎', 'edit-route'));
|
actions.appendChild(iconButton('Strecke bearbeiten', '✎', 'edit-route'));
|
||||||
|
if (routeSource(route) === 'local') {
|
||||||
actions.appendChild(iconButton('Strecke löschen', '×', 'delete-route', false, true));
|
actions.appendChild(iconButton('Strecke löschen', '×', 'delete-route', false, true));
|
||||||
|
}
|
||||||
item.append(label, actions);
|
item.append(label, actions);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@@ -1184,13 +1186,9 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
|||||||
|
|
||||||
async function deleteRouteFromList(route) {
|
async function deleteRouteFromList(route) {
|
||||||
const id = routeId(route);
|
const id = routeId(route);
|
||||||
if (!id) return;
|
if (!id || routeSource(route) !== 'local') return;
|
||||||
|
|
||||||
if (routeSource(route) === 'local') {
|
|
||||||
ns.LocalRoutes.remove(id);
|
ns.LocalRoutes.remove(id);
|
||||||
} else {
|
|
||||||
await sendDelete(`/routes/${encodeURIComponent(id)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (routeId(state.currentRoute) === id && state.currentSource === routeSource(route)) {
|
if (routeId(state.currentRoute) === id && state.currentSource === routeSource(route)) {
|
||||||
state.currentRoute = null;
|
state.currentRoute = null;
|
||||||
@@ -1214,7 +1212,9 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
|||||||
await loadRoute(route);
|
await loadRoute(route);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (action === 'delete-route') await deleteRouteFromList(route);
|
if (action === 'delete-route' && routeSource(route) === 'local') {
|
||||||
|
await deleteRouteFromList(route);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deletePoiFromList(poi) {
|
async function deletePoiFromList(poi) {
|
||||||
|
|||||||
+17
-2
@@ -19,7 +19,8 @@ test('editor markup and source describe local draft creation instead of immediat
|
|||||||
const css = await read('public/css/editor.css');
|
const css = await read('public/css/editor.css');
|
||||||
const ui = await read('public/js/editor-ui.js');
|
const ui = await read('public/js/editor-ui.js');
|
||||||
|
|
||||||
assert.match(html, /id="editor-button"/);
|
assert.match(html, /id="editor-button"[^>]+aria-label="Streckenverwaltung öffnen"/);
|
||||||
|
assert.match(html, /class="editor-button-icon"[^>]+src="images\/icons\/route-management\.svg"[^>]+alt=""/);
|
||||||
assert.match(html, /<dialog id="editor-dialog"/);
|
assert.match(html, /<dialog id="editor-dialog"/);
|
||||||
assert.match(html, /id="editor-route-form"/);
|
assert.match(html, /id="editor-route-form"/);
|
||||||
assert.match(html, /id="editor-poi-form"/);
|
assert.match(html, /id="editor-poi-form"/);
|
||||||
@@ -39,6 +40,7 @@ test('editor markup and source describe local draft creation instead of immediat
|
|||||||
assert.match(html, /id="editor-route-upload"[^>]+type="button"[^>]+hidden/);
|
assert.match(html, /id="editor-route-upload"[^>]+type="button"[^>]+hidden/);
|
||||||
assert.doesNotMatch(html, /accept="video\//);
|
assert.doesNotMatch(html, /accept="video\//);
|
||||||
assert.match(html, /ausschließlich in diesem Browser/i);
|
assert.match(html, /ausschließlich in diesem Browser/i);
|
||||||
|
await fs.access(path.join(root, 'public/images/icons/route-management.svg'));
|
||||||
|
|
||||||
assert.match(css, /\.editor-dialog/);
|
assert.match(css, /\.editor-dialog/);
|
||||||
assert.match(css, /\.editor-poi-list/);
|
assert.match(css, /\.editor-poi-list/);
|
||||||
@@ -48,6 +50,7 @@ test('editor markup and source describe local draft creation instead of immediat
|
|||||||
assert.match(css, /\.editor-media-remove/);
|
assert.match(css, /\.editor-media-remove/);
|
||||||
assert.match(css, /\.editor-danger-button/);
|
assert.match(css, /\.editor-danger-button/);
|
||||||
assert.match(css, /\.editor-icon-danger/);
|
assert.match(css, /\.editor-icon-danger/);
|
||||||
|
assert.match(css, /\.editor-button-icon/);
|
||||||
|
|
||||||
assert.match(ui, /readJson\(['"]\/routes\?activatedOnly=true['"]\)/);
|
assert.match(ui, /readJson\(['"]\/routes\?activatedOnly=true['"]\)/);
|
||||||
assert.match(ui, /ns\.LocalRoutes\.save\(/);
|
assert.match(ui, /ns\.LocalRoutes\.save\(/);
|
||||||
@@ -499,7 +502,19 @@ test('editing an activated server route uses PUT and never writes activation sta
|
|||||||
|
|
||||||
const routeList = elements.get('editor-route-list');
|
const routeList = elements.get('editor-route-list');
|
||||||
const serverItem = routeList.children.find(child => child.dataset.routeSource === 'server');
|
const serverItem = routeList.children.find(child => child.dataset.routeSource === 'server');
|
||||||
const editButton = serverItem.children[1].children[0];
|
const serverActions = serverItem.children[1];
|
||||||
|
assert.equal(serverActions.children.length, 1);
|
||||||
|
assert.equal(serverActions.children[0].dataset.editorAction, 'edit-route');
|
||||||
|
|
||||||
|
const forgedDelete = new FakeElement('', 'button');
|
||||||
|
forgedDelete.dataset.editorAction = 'delete-route';
|
||||||
|
serverActions.appendChild(forgedDelete);
|
||||||
|
routeList.dispatchEvent(pointerEvent(forgedDelete));
|
||||||
|
await tick();
|
||||||
|
await tick();
|
||||||
|
assert.equal(calls.some(call => call.method === 'DELETE' && call.url === '/api/routes/1'), false);
|
||||||
|
|
||||||
|
const editButton = serverActions.children[0];
|
||||||
routeList.dispatchEvent(pointerEvent(editButton));
|
routeList.dispatchEvent(pointerEvent(editButton));
|
||||||
await tick();
|
await tick();
|
||||||
await tick();
|
await tick();
|
||||||
|
|||||||
Reference in New Issue
Block a user