Skip to content
Snippets Groups Projects
Commit 8a97b384 authored by Ron Lucke's avatar Ron Lucke Committed by Jan-Hendrik Willms
Browse files

Courseware Block sortieren ist nicht persistent

Closes #5097

Merge request studip/studip!3813
parent 5fd1d9f5
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
:data-section-id="index" :data-section-id="index"
> >
<template #item="{element, index}"> <template #item="{element, index}">
<li class="cw-block-item cw-block-item-sortable"> <li class="cw-block-item cw-block-item-sortable" :data-block-id="element.id">
<span <span
:class="{ 'cw-sortable-handle-dragging': isDragging }" :class="{ 'cw-sortable-handle-dragging': isDragging }"
class="cw-sortable-handle" class="cw-sortable-handle"
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<template #item="{element}"> <template #item="{element}">
<li <li
class="cw-block-item cw-block-item-sortable" class="cw-block-item cw-block-item-sortable"
:data-block-id="element.id"
> >
<span <span
:class="{ 'cw-sortable-handle-dragging': isDragging }" :class="{ 'cw-sortable-handle-dragging': isDragging }"
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
:data-section-id="sectionIndex" :data-section-id="sectionIndex"
> >
<template #item="{element}"> <template #item="{element}">
<li class="cw-block-item cw-block-item-sortable"> <li class="cw-block-item cw-block-item-sortable" :data-block-id="element.id">
<span <span
:class="{ 'cw-sortable-handle-dragging': isDragging }" :class="{ 'cw-sortable-handle-dragging': isDragging }"
class="cw-sortable-handle" class="cw-sortable-handle"
......
...@@ -39,16 +39,16 @@ const containerMixin = { ...@@ -39,16 +39,16 @@ const containerMixin = {
dropBlock(e) { dropBlock(e) {
this.isDragging = false; // implemented by each container type this.isDragging = false; // implemented by each container type
let data = {}; let data = {};
data.originContainerId = e.from.__vnode.ctx.attrs.containerId; data.originContainerId = e.from.dataset.containerId;
data.targetContainerId = e.to.__vnode.ctx.attrs.containerId; data.targetContainerId = e.to.dataset.containerId;
if (data.originContainerId === data.targetContainerId) { if (data.originContainerId === data.targetContainerId) {
this.storeSort(); // implemented by each container type this.storeSort(); // implemented by each container type
} else { } else {
data.originSectionId = e.from.__vnode.ctx.attrs.sectionId; data.originSectionId = e.from.dataset.sectionId;
data.originSectionBlockList = e.from.__vnode.children.map(b => { return b.ctx.attrs.blockId; }); data.originSectionBlockList = [...e.from.children].map(b => b.dataset.blockId);
data.targetSectionId = e.to.__vnode.ctx.attrs.sectionId; data.targetSectionId = e.to.dataset.sectionId;
data.targetSectionBlockList = e.to.__vnode.children.map(b => { return b.ctx.attrs.blockId; }); data.targetSectionBlockList = [...e.to.children].map(b => b.dataset.blockId);
data.blockId = e.item._underlying_vm_.id; data.blockId = e.item.dataset.blockId;
data.newPos = e.newIndex; data.newPos = e.newIndex;
const indexInBlockList = data.targetSectionBlockList.findIndex(b => b === data.blockId); const indexInBlockList = data.targetSectionBlockList.findIndex(b => b === data.blockId);
data.targetSectionBlockList.splice(data.newPos, 0, data.targetSectionBlockList.splice(indexInBlockList,1)[0]); // move block id to new position data.targetSectionBlockList.splice(data.newPos, 0, data.targetSectionBlockList.splice(indexInBlockList,1)[0]); // move block id to new position
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment