Skip to content
Snippets Groups Projects
Commit e7682d12 authored by Ron Lucke's avatar Ron Lucke
Browse files

fix #2099

Closes #2099

Merge request studip/studip!1359
parent 1b239466
No related branches found
No related tags found
No related merge requests found
...@@ -89,7 +89,8 @@ export default { ...@@ -89,7 +89,8 @@ export default {
unlockObject: 'unlockObject', unlockObject: 'unlockObject',
sortChildrenInStructualElements: 'sortChildrenInStructualElements', sortChildrenInStructualElements: 'sortChildrenInStructualElements',
loadStructuralElement: 'loadStructuralElement', loadStructuralElement: 'loadStructuralElement',
setAssistiveLiveContents: 'setAssistiveLiveContents' setAssistiveLiveContents: 'setAssistiveLiveContents',
companionError: 'companionError',
}), }),
updateNestedChildren() { updateNestedChildren() {
this.nestedChildren = this.getNestedChildren(this.rootElement); this.nestedChildren = this.getNestedChildren(this.rootElement);
...@@ -119,10 +120,20 @@ export default { ...@@ -119,10 +120,20 @@ export default {
const tree = this.$refs.tree; const tree = this.$refs.tree;
const currentScrollPosition = tree.offsetParent.scrollTop; const currentScrollPosition = tree.offsetParent.scrollTop;
this.processing = true; this.processing = true;
await this.loadStructuralElement(data.newParent);
const newParent = this.structuralElementById({ id: data.newParent });
if (!newParent.attributes['can-edit']) {
this.processing = false;
this.updateNestedChildren();
this.companionError({
info: this.$gettext('Verschieben nicht möglich. Sie haben keine Schreibrechte für die Ziel-Seite.')
});
return;
}
if (data.oldParent !== data.newParent) { if (data.oldParent !== data.newParent) {
await this.lockObject({ id: data.id, type: 'courseware-structural-elements' }); await this.lockObject({ id: data.id, type: 'courseware-structural-elements' });
let element = this.structuralElementById({ id: data.id }); let element = this.structuralElementById({ id: data.id });
element.relationships.parent.data.id = data.newParent; element.relationships.parent.data.id = newParent.id;
await this.updateStructuralElement({ await this.updateStructuralElement({
element: element, element: element,
id: element.id, id: element.id,
...@@ -130,8 +141,8 @@ export default { ...@@ -130,8 +141,8 @@ export default {
await this.unlockObject({ id: data.id, type: 'courseware-structural-elements' }); await this.unlockObject({ id: data.id, type: 'courseware-structural-elements' });
await this.loadStructuralElement(data.id); await this.loadStructuralElement(data.id);
} }
await this.loadStructuralElement(data.newParent); await this.loadStructuralElement(newParent.id);
const parent = this.structuralElementById({ id: data.newParent }); const parent = this.structuralElementById({ id: newParent.id });
await this.sortChildrenInStructualElements({parent: parent, children: data.sortArray}); await this.sortChildrenInStructualElements({parent: parent, children: data.sortArray});
this.updateNestedChildren(); this.updateNestedChildren();
this.processing = false; this.processing = false;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
> >
<div class="cw-tree-item-wrapper"> <div class="cw-tree-item-wrapper">
<span <span
v-if="editMode && depth > 0" v-if="editMode && depth > 0 && canEdit"
class="cw-sortable-handle" class="cw-sortable-handle"
:tabindex="0" :tabindex="0"
aria-describedby="operation" aria-describedby="operation"
...@@ -270,6 +270,9 @@ export default { ...@@ -270,6 +270,9 @@ export default {
ghostClass: "cw-tree-item-ghost" ghostClass: "cw-tree-item-ghost"
}; };
}, },
canEdit() {
return this.element.attributes['can-edit'];
}
}, },
methods: { methods: {
...mapActions({ ...mapActions({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment