Skip to content
Merged
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
6 changes: 4 additions & 2 deletions common/lib/xmodule/xmodule/seq_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,9 @@ def _render_student_view_for_items(self, context, display_items, fragment, view=
display_items. Returns a list of dict objects with information about
the given display_items.
"""
# Avoid circular imports.
from openedx.core.lib.xblock_utils import get_icon

render_items = not context.get('exclude_units', False)
is_user_authenticated = self.is_user_authenticated(context)
completion_service = self.runtime.service(self, 'completion')
Expand All @@ -708,8 +711,7 @@ def _render_student_view_for_items(self, context, display_items, fragment, view=
]
contents = []
for item in display_items:
# NOTE (CCB): This seems like a hack, but I don't see a better method of determining the type/category.
item_type = item.get_icon_class()
item_type = get_icon(item)
usage_id = item.scope_ids.usage_id

show_bookmark_button = False
Expand Down
5 changes: 5 additions & 0 deletions docs/guides/extension_points.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ Here are the different integration points that python plugins can use:
* - XBlock unit tests (``xblock.test.v0``)
- Assess, Limited
- XBlocks can also install test code that will then be run alongside the platform's usual python unit tests. It's unclear how well-supported this is at the moment.
* - Pluggable override (``edx_django_utils.plugins.pluggable_override.pluggable_override``)
- Trial, Stable
- This decorator allows overriding any function or method by pointing to an alternative implementation in settings. Read the |pluggable_override docstring|_ to learn more.

.. _Application: https://docs.djangoproject.com/en/3.0/ref/applications/
.. _Django app plugin documentation: https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/plugins/README.rst
Expand All @@ -146,6 +149,8 @@ Here are the different integration points that python plugins can use:
.. _learning_context.py: https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/xblock/learning_context/learning_context.py
.. |UserPartition docstring| replace:: ``UserPartition`` docstring
.. _UserPartition docstring: https://github.com/edx/edx-platform/blob/f8cc58618a39c9f7b8e9e1001eb2d7a10395797e/common/lib/xmodule/xmodule/partitions/partitions.py#L105-L120
.. |pluggable_override docstring| replace:: ``pluggable_override`` docstring
.. _pluggable_override docstring: https://github.com/edx/edx-django-utils/blob/master/edx_django_utils/plugins/pluggable_override.py

Platform Look & Feel
====================
Expand Down
1 change: 1 addition & 0 deletions lms/devstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ VIDEO_UPLOAD_PIPELINE:
ROOT_PATH: ''
WIKI_ENABLED: true
WRITABLE_GRADEBOOK_URL: null
XBLOCK_EXTRA_MIXINS: []
XBLOCK_FS_STORAGE_BUCKET: null
XBLOCK_FS_STORAGE_PREFIX: null
XBLOCK_SETTINGS: {}
Expand Down
1 change: 1 addition & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,7 @@ def _make_mako_template_dirs(settings):
# This should be moved into an XBlock Runtime/Application object
# once the responsibility of XBlock creation is moved out of modulestore - cpennington
XBLOCK_MIXINS = (LmsBlockMixin, InheritanceMixin, XModuleMixin, EditInfoMixin)
XBLOCK_EXTRA_MIXINS = ()

# .. setting_name: XBLOCK_SELECT_FUNCTION
# .. setting_default: prefer_xmodules
Expand Down
3 changes: 3 additions & 0 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,3 +1047,6 @@ def get_env_setting(setting):
}

LOGO_IMAGE_EXTRA_TEXT = ENV_TOKENS.get('LOGO_IMAGE_EXTRA_TEXT', '')

############## XBlock extra mixins ############################
XBLOCK_MIXINS += tuple(XBLOCK_EXTRA_MIXINS)
11 changes: 11 additions & 0 deletions openedx/core/lib/xblock_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse
from django.utils.html import escape
from edx_django_utils.plugins import pluggable_override
from lxml import etree, html
from opaque_keys.edx.asides import AsideUsageKeyV1, AsideUsageKeyV2
from pytz import UTC
Expand Down Expand Up @@ -554,3 +555,13 @@ def hash_resource(resource):
else:
md5.update(repr(data).encode('utf-8'))
return md5.hexdigest()


@pluggable_override('OVERRIDE_GET_UNIT_ICON')
def get_icon(block):
"""
A function that returns the CSS class representing an icon to use for this particular
XBlock (in the courseware navigation bar). Mostly used for Vertical/Unit XBlocks.
It can be overridden by setting `GET_UNIT_ICON_IMPL` to an alternative implementation.
"""
return block.get_icon_class()
2 changes: 1 addition & 1 deletion requirements/edx/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ edx-celeryutils
edx-completion
edx-django-release-util # Release utils for the edx release pipeline
edx-django-sites-extensions
edx-django-utils>=3.12.0 # Utilities for cache, monitoring, and plugins; 3.12.0+ for set_code_owner_attribute method
edx-django-utils>=3.16.0 # Utilities for cache, monitoring, and plugins; 3.16.0+ for the `pluggable_override`
edx-drf-extensions
edx-enterprise
edx-event-routing-backends
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ edx-celeryutils==1.0.0 # via -r requirements/edx/base.in, super-csv
edx-completion==4.0.3 # via -r requirements/edx/base.in
edx-django-release-util==1.0.0 # via -r requirements/edx/base.in
edx-django-sites-extensions==3.0.0 # via -r requirements/edx/base.in
edx-django-utils==3.15.0 # via -r requirements/edx/base.in, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-django-utils==3.16.0 # via -r requirements/edx/base.in, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-drf-extensions==6.5.0 # via -r requirements/edx/base.in, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
edx-enterprise==3.21.0 # via -c requirements/edx/../constraints.txt, -r requirements/edx/base.in
edx-event-routing-backends==4.0.1 # via -r requirements/edx/base.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ edx-celeryutils==1.0.0 # via -r requirements/edx/testing.txt, super-csv
edx-completion==4.0.3 # via -r requirements/edx/testing.txt
edx-django-release-util==1.0.0 # via -r requirements/edx/testing.txt
edx-django-sites-extensions==3.0.0 # via -r requirements/edx/testing.txt
edx-django-utils==3.15.0 # via -r requirements/edx/testing.txt, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-django-utils==3.16.0 # via -r requirements/edx/testing.txt, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-drf-extensions==6.5.0 # via -r requirements/edx/testing.txt, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
edx-enterprise==3.21.0 # via -c requirements/edx/../constraints.txt, -r requirements/edx/testing.txt
edx-event-routing-backends==4.0.1 # via -r requirements/edx/testing.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ edx-celeryutils==1.0.0 # via -r requirements/edx/base.txt, super-csv
edx-completion==4.0.3 # via -r requirements/edx/base.txt
edx-django-release-util==1.0.0 # via -r requirements/edx/base.txt
edx-django-sites-extensions==3.0.0 # via -r requirements/edx/base.txt
edx-django-utils==3.15.0 # via -r requirements/edx/base.txt, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-django-utils==3.16.0 # via -r requirements/edx/base.txt, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-drf-extensions==6.5.0 # via -r requirements/edx/base.txt, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
edx-enterprise==3.21.0 # via -c requirements/edx/../constraints.txt, -r requirements/edx/base.txt
edx-event-routing-backends==4.0.1 # via -r requirements/edx/base.txt
Expand Down