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 {
unlockObject: 'unlockObject',
sortChildrenInStructualElements: 'sortChildrenInStructualElements',
loadStructuralElement: 'loadStructuralElement',
setAssistiveLiveContents: 'setAssistiveLiveContents'
setAssistiveLiveContents: 'setAssistiveLiveContents',
companionError: 'companionError',
}),
updateNestedChildren() {
this.nestedChildren = this.getNestedChildren(this.rootElement);
......@@ -119,10 +120,20 @@ export default {
const tree = this.$refs.tree;
const currentScrollPosition = tree.offsetParent.scrollTop;
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) {
await this.lockObject({ id: data.id, type: 'courseware-structural-elements' });
let element = this.structuralElementById({ id: data.id });
element.relationships.parent.data.id = data.newParent;
element.relationships.parent.data.id = newParent.id;
await this.updateStructuralElement({
element: element,
id: element.id,
......@@ -130,8 +141,8 @@ export default {
await this.unlockObject({ id: data.id, type: 'courseware-structural-elements' });
await this.loadStructuralElement(data.id);
}
await this.loadStructuralElement(data.newParent);
const parent = this.structuralElementById({ id: data.newParent });
await this.loadStructuralElement(newParent.id);
const parent = this.structuralElementById({ id: newParent.id });
await this.sortChildrenInStructualElements({parent: parent, children: data.sortArray});
this.updateNestedChildren();
this.processing = false;
......
......@@ -8,7 +8,7 @@
>
<div class="cw-tree-item-wrapper">
<span
v-if="editMode && depth > 0"
v-if="editMode && depth > 0 && canEdit"
class="cw-sortable-handle"
:tabindex="0"
aria-describedby="operation"
......@@ -270,6 +270,9 @@ export default {
ghostClass: "cw-tree-item-ghost"
};
},
canEdit() {
return this.element.attributes['can-edit'];
}
},
methods: {
...mapActions({
......@@ -436,4 +439,4 @@ export default {
},
}
};
</script>
\ No newline at end of file
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment