Drag-Griff statt ganzem Element + Uebungs-Reihenfolge beim Start uebernehmen
Image bauen und in die Registry schieben / build (push) Successful in 6s
Image bauen und in die Registry schieben / build (push) Successful in 6s
- Sortieren nur ueber einen kleinen Griff (Punkt-Icon) links im Uebungskopf; das ganze Element ist nicht mehr draggable (kein versehentliches Ziehen beim Tippen/Auswaehlen) - Beim Session-Start wird die Uebungs-Reihenfolge der letzten abgeschlossenen Session desselben Tags uebernommen (server-seitig in create_session, in session.fields.exerciseOrder) - Tests: 170 Checks gruen (40+18+52+32+28)
This commit is contained in:
1 parent
7c5045cec8
commit
aebd7f40e7
5 files changed
+60
-12
No files matched your search
@@ -782,17 +782,16 @@ function reorderExercise(a, model, fromKey, toKey) {
|
||||
scheduleAutosave(model);
|
||||
}
|
||||
|
||||
function attachDragReorder(a, model, ex, block) {
|
||||
block.draggable = true;
|
||||
block.title = t("reorder_hint");
|
||||
block.addEventListener("dragstart", ev => {
|
||||
function attachDragReorder(a, model, ex, block, grip) {
|
||||
grip.draggable = true;
|
||||
grip.addEventListener("dragstart", ev => {
|
||||
app.dragKey = ex.key;
|
||||
try {
|
||||
ev.dataTransfer = ev.dataTransfer || {};
|
||||
ev.dataTransfer.setData("text/plain", ex.key);
|
||||
} catch (_) {}
|
||||
});
|
||||
block.addEventListener("dragend", () => {
|
||||
grip.addEventListener("dragend", () => {
|
||||
app.dragKey = null;
|
||||
for (const b of $$(".ex-block.drag-over")) b.classList.remove("drag-over");
|
||||
});
|
||||
@@ -850,6 +849,14 @@ function buildExBlock(a, model, ex, removable) {
|
||||
model.exByKey[ex.key] = ex;
|
||||
|
||||
const head = el("div", "ex-head");
|
||||
const grip = el("span", "ex-grip", "");
|
||||
grip.innerHTML = '<svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true">'
|
||||
+ '<circle cx="6" cy="4" r="1.4"/><circle cx="10" cy="4" r="1.4"/>'
|
||||
+ '<circle cx="6" cy="8" r="1.4"/><circle cx="10" cy="8" r="1.4"/>'
|
||||
+ '<circle cx="6" cy="12" r="1.4"/><circle cx="10" cy="12" r="1.4"/></svg>';
|
||||
grip.title = t("reorder_hint");
|
||||
grip.setAttribute("aria-label", t("reorder_hint"));
|
||||
head.appendChild(grip);
|
||||
const infoBtn = el("button", "icon-btn", "?");
|
||||
infoBtn.type = "button";
|
||||
infoBtn.setAttribute("aria-label", t("info_aria") + ex.name);
|
||||
@@ -878,7 +885,7 @@ function buildExBlock(a, model, ex, removable) {
|
||||
|
||||
block.appendChild(el("div", "set-rows"));
|
||||
renderExRows(a, model, ex);
|
||||
attachDragReorder(a, model, ex, block);
|
||||
attachDragReorder(a, model, ex, block, grip);
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user