Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Drop xmodule CSS classes in favor of standard xblock CSS classes #35834

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions openedx/core/lib/xblock_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,31 +102,14 @@ def wrap_xblock(
if context:
data.update(context.get('wrap_xblock_data', {}))

css_classes = [
'xblock',
f'xblock-{markupsafe.escape(view)}',
'xblock-{}-{}'.format(
markupsafe.escape(view),
markupsafe.escape(block.scope_ids.block_type),
)
]

view_safe = markupsafe.escape(view)
block_type_safe = markupsafe.escape(block.scope_ids.block_type)
css_classes = ['xblock', f'xblock-{view_safe}', f'xblock-{view_safe}-{block_type_safe}']
if view in PREVIEW_VIEWS:
css_classes += ['xblock-display', f'xblock-display-{block_type_safe}']
if view == STUDENT_VIEW and getattr(block, 'HIDDEN', False):
css_classes.append('is-hidden')

# TODO: This special case will be removed when we update the SCSS under
# xmodule/assets to use the standard XBlock CSS classes.
# See https://github.com/openedx/edx-platform/issues/32617.
if getattr(block, 'uses_xmodule_styles_setup', False):
if view in PREVIEW_VIEWS:
# The block is acting as an XModule
css_classes.append('xmodule_display')
elif view == STUDIO_VIEW:
# The block is acting as an XModuleDescriptor
css_classes.append('xmodule_edit')

css_classes.append('xmodule_' + markupsafe.escape(class_name))

if frag.js_init_fn:
data['init'] = frag.js_init_fn
data['runtime-class'] = runtime_class
Expand Down
Loading
Loading