diff --git a/lib/classes/JsonApi/Routes/Courseware/StructuralElementsCreate.php b/lib/classes/JsonApi/Routes/Courseware/StructuralElementsCreate.php index c8ab5e1e4f814f46ed28bebc83b50b07bf42c54d..47ada6399823c521b330fe7ef360eaf75b2f307e 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 e8de3b1518bd8ea6fb1a393d77e0f2adf7c8566e..97abfec4449ac7209716e76250ebd1e1175a4095 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,