From 30eda7385c1e08f455a5c5d6a99325980f3483f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Thu, 10 Oct 2024 18:47:47 -0300 Subject: [PATCH] feat: add library-v2 --- .../contentstore/views/component.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index ba767df78dc9..5779d3cd23dd 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -41,10 +41,14 @@ log = logging.getLogger(__name__) # NOTE: This list is disjoint from ADVANCED_COMPONENT_TYPES -COMPONENT_TYPES = ['discussion', 'library', 'html', 'openassessment', 'problem', 'video', 'drag-and-drop-v2'] +COMPONENT_TYPES = ['discussion', 'library', 'library-v2', 'html', 'openassessment', 'problem', 'video', 'drag-and-drop-v2'] ADVANCED_COMPONENT_TYPES = sorted({name for name, class_ in XBlock.load_classes()} - set(COMPONENT_TYPES)) +# Log the list of XBlocks that are loaded +for block in XBlock.load_classes(): + log.error(block) + ADVANCED_PROBLEM_TYPES = settings.ADVANCED_PROBLEM_TYPES LIBRARY_BLOCK_TYPES = settings.LIBRARY_BLOCK_TYPES @@ -215,7 +219,8 @@ def create_support_legend_dict(): 'problem': _("Problem"), 'video': _("Video"), 'openassessment': _("Open Response"), - 'library': _("Library Content"), + 'library': _("Legacy Library"), + 'library-v2': _("Library Content"), 'drag-and-drop-v2': _("Drag and Drop"), } @@ -226,7 +231,7 @@ def create_support_legend_dict(): component_types = COMPONENT_TYPES[:] # Libraries do not support discussions, drag-and-drop, and openassessment and other libraries - component_not_supported_by_library = ['discussion', 'library', 'openassessment', 'drag-and-drop-v2'] + component_not_supported_by_library = ['discussion', 'library', 'library-v2', 'openassessment', 'drag-and-drop-v2'] if library: component_types = [component for component in component_types if component not in set(component_not_supported_by_library)] @@ -245,7 +250,7 @@ def create_support_legend_dict(): templates_for_category = [] component_class = _load_mixed_class(category) - if support_level_without_template and category != 'library': + if support_level_without_template and category not in ['library', 'library-v2']: # add the default template with localized display name # TODO: Once mixins are defined per-application, rather than per-runtime, # this should use a cms mixed-in class. (cpennington) @@ -418,6 +423,12 @@ def create_support_legend_dict(): if advanced_component_templates['templates']: component_templates.insert(0, advanced_component_templates) + # component_templates.append({ + # "type": "abc", + # "templates": "abc", + # "display_name": "ABC", + # "support_legend": create_support_legend_dict() + # }) return component_templates