From bef8f9904449403dad27f4931da008efee7ff90d Mon Sep 17 00:00:00 2001 From: Ron Lucke <lucke@elan-ev.de> Date: Fri, 21 Oct 2022 07:15:56 +0000 Subject: [PATCH] fix #1699 Closes #1699 Merge request studip/studip!1100 --- .../Routes/Courseware/StructuralElementsCreate.php | 2 ++ .../components/courseware/CoursewareStructuralElement.vue | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/classes/JsonApi/Routes/Courseware/StructuralElementsCreate.php b/lib/classes/JsonApi/Routes/Courseware/StructuralElementsCreate.php index c8ab5e1e4f8..47ada639982 100644 --- a/lib/classes/JsonApi/Routes/Courseware/StructuralElementsCreate.php +++ b/lib/classes/JsonApi/Routes/Courseware/StructuralElementsCreate.php @@ -81,6 +81,8 @@ class StructuralElementsCreate extends JsonApiController 'title' => self::arrayGet($json, 'data.attributes.title', ''), 'purpose' => self::arrayGet($json, 'data.attributes.purpose', $parent->purpose), '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() ]); diff --git a/resources/vue/components/courseware/CoursewareStructuralElement.vue b/resources/vue/components/courseware/CoursewareStructuralElement.vue index e8de3b1518b..97abfec4449 100644 --- a/resources/vue/components/courseware/CoursewareStructuralElement.vue +++ b/resources/vue/components/courseware/CoursewareStructuralElement.vue @@ -1576,6 +1576,8 @@ export default { async createElement() { let title = this.newChapterName; // this is the title of the new element 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']; this.errorEmptyChapterName = title.trim(); if (this.errorEmptyChapterName === '') { @@ -1583,11 +1585,15 @@ export default { } if (this.newChapterParent === 'sibling') { parent_id = this.structuralElement.relationships.parent.data.id; + writeApproval = []; + readApproval = []; } this.showElementAddDialog(false); await this.createStructuralElement({ attributes: { - title, + title: title, + 'write-approval': writeApproval, + 'read-approval': readApproval }, parentId: parent_id, currentId: this.currentId, -- GitLab