Skip to content

Commit

Permalink
feat: [AXIMST-338] add temporary decision for child action
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzniaievdm committed Jan 15, 2024
1 parent dee7c81 commit 458cb83
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,23 @@ class ChildVerticalContainerSerializer(serializers.Serializer):
name = serializers.CharField(source="display_name_with_default")
block_id = serializers.CharField(source="location")
block_type = serializers.CharField(source="location.block_type")
actions = serializers.SerializerMethodField()

def get_actions(self, obj): # pylint: disable=unused-argument
"""
Method to get actions for each child xlock of the unit.
"""

# temporary decision defining the default value 'True' for each xblock.
actions = {
"can_copy": True,
"can_duplicate": True,
"can_move": True,
"can_manage_access": True,
"can_delete": True,
}

return actions


class VerticalContainerSerializer(serializers.Serializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,25 @@ def test_children_content(self):
"name": self.html_unit_first.display_name_with_default,
"block_id": str(self.html_unit_first.location),
"block_type": self.html_unit_first.location.block_type,
"actions": {
"can_copy": True,
"can_duplicate": True,
"can_move": True,
"can_manage_access": True,
"can_delete": True
}
},
{
"name": self.html_unit_second.display_name_with_default,
"block_id": str(self.html_unit_second.location),
"block_type": self.html_unit_second.location.block_type,
"actions": {
"can_copy": True,
"can_duplicate": True,
"can_move": True,
"can_manage_access": True,
"can_delete": True
}
},
]
self.assertEqual(response.data["children"], expected_response)
Expand Down
27 changes: 24 additions & 3 deletions cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,38 @@ def get(self, request: Request, usage_key_string: str):
{
"name": "Drag and Drop",
"block_id": "block-v1:org+101+101+type@drag-and-drop-v2+block@7599275ace6b46f5a482078a2954ca16",
"block_type": "drag-and-drop-v2"
"block_type": "drag-and-drop-v2",
"actions": {
"can_copy": true,
"can_duplicate": true,
"can_move": true,
"can_manage_access": true,
"can_delete": true
}
},
{
"name": "Video",
"block_id": "block-v1:org+101+101+type@video+block@0e3d39b12d7c4345981bda6b3511a9bf",
"block_type": "video"
"block_type": "video",
"actions": {
"can_copy": true,
"can_duplicate": true,
"can_move": true,
"can_manage_access": true,
"can_delete": true
}
},
{
"name": "Text",
"block_id": "block-v1:org+101+101+type@html+block@3e3fa1f88adb4a108cd14e9002143690",
"block_type": "html"
"block_type": "html",
"actions": {
"can_copy": true,
"can_duplicate": true,
"can_move": true,
"can_manage_access": true,
"can_delete": true
}
},
],
"is_published": false
Expand Down

0 comments on commit 458cb83

Please sign in to comment.