Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Use case

Transfer to xblock API view Three dots menu Action fields, so it’s possible to conditionally display those actions in the frontend-course-authoring based on user’s role.

  • expand of already existed container children API with actions(can_copy, can_duplicate, can_move, can_manage_access, can_delete)

PR with initial endpoint implementation - https://github.com/openedx/edx-platform/pull/34036

Problem statement

We are currently working with rendering unit’s children.
For each xblock need to have actions which are responsible for displaying the availability of an action.
We wanted to use JSON structure below:

{
  "children": [
      {
          "name": "Drag and Drop",
          "block_id": "block-v1:org+101+101+type@drag-and-drop-v2+block@7599275ace6b46f5a482078a2954ca16",
          "block_type": "drag-and-drop-v2",
          "actions": {
              "can_copy": true,
              "can_duplicate": true,
              "can_move": true,
              "can_manage_access": true,
              "can_delete": true
          }
      },
			...
		]
}

But we faced with problem getting condition for displaying these actions.
The required condition placed in _studio_wrap_xblock where runtime wraps the block with template studio_xblock_wrapper.html and collects context on previous function calls.

def xblock_view_handler
-> get_preview_fragment
-> -> _load_preview_block
-> -> -> _prepare_runtime_for_preview
-> -> -> -> _studio_wrap_xblock:

Right now it is problematic to get the context from there because of the nesting, so can we use other conditions to display?

The main question is: what is the best approach to add those actions without refactoring the code around _studio_wrap_xblock

Additional context

Existing implementation (legacy studio) notes

Below you can see the list of three dots menu actions with references to places in which the action context field is populated.


COPY from _studio_wrap_xblockis_course

python

POST http://localhost:18010/api/content-staging/v1/clipboard/{	usage_key: xblock_id}action: save in store

DUPLICATE from _studio_wrap_xblockcan_add

python

POST http://localhost:18010/xblock/{	duplicate_source_locator: xblock_id	parent_locator: vertical_id}action: refetch xblock_children + parent?

MOVE from _studio_wrap_xblockcan_move

python

PATCH http://localhost:18010/xblock/{	move_source_locator: xblock_id,	parent_locator: vertical_id}action: refetch xblock_children + parent?

MANAGE ACCESS from _studio_wrap_xblockcan_edit_visibility

send metadata with user_partition_info


DELETE from _studio_wrap_xblockcan_add

python

DELETE http://localhost:18010/xblock/block-v1:org+101+101+type@drag-and-drop-v2+block@21f5803720d940bf936103cecfe6dc9caction: refetch xblock_children + parent?

Label Text from _studio_wrap_xblock -> selected_groups_label

image-20240207-165223.png

Manage tags use_tagging = use_tagging_taxonomy_list_page()

References

Copy/paste extension for Action fields in legacy interface: PR: https://github.com/openedx/edx-platform/pull/31853/ "

  • No labels