It is possible to set custom logos in microfrontends, for instance with the LOGO_URL setting. Ideally, we would like that MFEs share the same logos as the LMS. But this is made difficult when comprehensive theming is enabled, and the logo is overridden by a custom theme. In that scenario, the logo url becomes /static/mytheme/images/logo.png. But the MFEs do no know that the "mytheme" theme is enabled. To resolve this issue, we introduce here a view, at the "/theming/asset/<path>" url, that redirects to the corresponding asset in the theme that is currently enabled. Thus, MFEs only have to set `LOGO_URL=http://lmshost/theming/asset/images/logo.png` to point to the themed logo. Related issue: https://github.com/overhangio/tutor-mfe/issues/25
30 lines
572 B
Python
30 lines
572 B
Python
"""
|
|
Defines URLs for theming views.
|
|
"""
|
|
|
|
|
|
from django.conf.urls import url
|
|
from django.urls import path
|
|
|
|
from . import helpers
|
|
from . import views
|
|
|
|
app_name = "openedx.core.djangoapps.theming"
|
|
|
|
urlpatterns = [
|
|
path(
|
|
"asset/<path:path>",
|
|
views.themed_asset,
|
|
name="openedx.theming.asset",
|
|
),
|
|
]
|
|
|
|
if helpers.is_comprehensive_theming_enabled():
|
|
urlpatterns += [
|
|
url(
|
|
r"^admin",
|
|
views.ThemingAdministrationFragmentView.as_view(),
|
|
name="openedx.theming.update_theme_fragment_view",
|
|
),
|
|
]
|