fix: show correct icons in the sidebar for units with custom XBlocks
Currently, the sidebar relies only on the XBlock's `category` class attribute (called `type` in the transformers). This behavior is inconsistent with the legacy subsection navigation, which relies on the `XModuleMixin.get_icon_class` method. This commit adds the `icon_class` to the fields collected by the transformers and uses it to determine whether the "problem" or "video" icon should be displayed for a unit in the sidebar.
This commit is contained in:
committed by
Farhaan Bukhsh
parent
64190d1e13
commit
bbc0cc2baa
@@ -59,6 +59,7 @@ SUPPORTED_FIELDS = [
|
||||
SupportedFieldType('weight'),
|
||||
SupportedFieldType('show_correctness'),
|
||||
SupportedFieldType('hide_from_toc'),
|
||||
SupportedFieldType('icon_class'),
|
||||
# 'student_view_data'
|
||||
SupportedFieldType(StudentViewTransformer.STUDENT_VIEW_DATA, StudentViewTransformer),
|
||||
# 'student_view_multi_device'
|
||||
|
||||
@@ -54,7 +54,15 @@ class BlocksAPITransformer(BlockStructureTransformer):
|
||||
transform method.
|
||||
"""
|
||||
# collect basic xblock fields
|
||||
block_structure.request_xblock_fields('graded', 'format', 'display_name', 'category', 'due', 'show_correctness')
|
||||
block_structure.request_xblock_fields(
|
||||
'graded',
|
||||
'format',
|
||||
'display_name',
|
||||
'category',
|
||||
'due',
|
||||
'show_correctness',
|
||||
'icon_class',
|
||||
)
|
||||
|
||||
# collect data from containing transformers
|
||||
StudentViewTransformer.collect(block_structure)
|
||||
|
||||
Reference in New Issue
Block a user