Skip to content

Commit

Permalink
feat: add library-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Oct 11, 2024
1 parent d6a8c10 commit 30eda73
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions cms/djangoapps/contentstore/views/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"),
}

Expand All @@ -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)]
Expand All @@ -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)
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 30eda73

Please sign in to comment.