Skip to content
Snippets Groups Projects
Commit ef2c8684 authored by Ron Lucke's avatar Ron Lucke Committed by Elmar Ludwig
Browse files

fix #1699

Closes #1699

Merge request studip/studip!1100
parent adc32cbb
No related branches found
No related tags found
No related merge requests found
...@@ -81,6 +81,8 @@ class StructuralElementsCreate extends JsonApiController ...@@ -81,6 +81,8 @@ class StructuralElementsCreate extends JsonApiController
'title' => self::arrayGet($json, 'data.attributes.title', ''), 'title' => self::arrayGet($json, 'data.attributes.title', ''),
'purpose' => self::arrayGet($json, 'data.attributes.purpose', $parent->purpose), 'purpose' => self::arrayGet($json, 'data.attributes.purpose', $parent->purpose),
'payload' => self::arrayGet($json, 'data.attributes.payload', ''), 'payload' => self::arrayGet($json, 'data.attributes.payload', ''),
'read_approval' => self::arrayGet($json, 'data.attributes.read-approval', []),
'write_approval' => self::arrayGet($json, 'data.attributes.write-approval', []),
'position' => $parent->countChildren() 'position' => $parent->countChildren()
]); ]);
......
...@@ -1316,16 +1316,22 @@ export default { ...@@ -1316,16 +1316,22 @@ export default {
async createElement() { async createElement() {
let title = this.newChapterName; // this is the title of the new element let title = this.newChapterName; // this is the title of the new element
let parent_id = this.currentId; // new page is descandant as default let parent_id = this.currentId; // new page is descandant as default
let writeApproval = this.currentElement.attributes['write-approval'];
let readApproval = this.currentElement.attributes['read-approval'];
if (this.errorEmptyChapterName = title.trim() === '') { if (this.errorEmptyChapterName = title.trim() === '') {
return; return;
} }
if (this.newChapterParent === 'sibling') { if (this.newChapterParent === 'sibling') {
parent_id = this.structuralElement.relationships.parent.data.id; parent_id = this.structuralElement.relationships.parent.data.id;
writeApproval = [];
readApproval = [];
} }
this.showElementAddDialog(false); this.showElementAddDialog(false);
await this.createStructuralElement({ await this.createStructuralElement({
attributes: { attributes: {
title, title: title,
'write-approval': writeApproval,
'read-approval': readApproval
}, },
parentId: parent_id, parentId: parent_id,
currentId: this.currentId, currentId: this.currentId,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment