From 5f10a56bedce6cfa4c577bcd0341c5463850dbfe Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Thu, 29 Aug 2024 18:49:24 -0500 Subject: [PATCH] fix: add patches to compile and enable themes --- tutorpicasso/patches/cms-env | 3 +++ tutorpicasso/patches/lms-env | 3 +++ .../patches/openedx-cms-production-settings | 6 +++++ .../patches/openedx-common-assets-settings | 3 +++ .../patches/openedx-development-settings | 6 +++++ .../patches/openedx-dockerfile-pre-assets | 23 +++++++++++++++++++ .../patches/openedx-lms-production-settings | 6 +++++ 7 files changed, 50 insertions(+) create mode 100644 tutorpicasso/patches/cms-env create mode 100644 tutorpicasso/patches/lms-env create mode 100644 tutorpicasso/patches/openedx-cms-production-settings create mode 100644 tutorpicasso/patches/openedx-common-assets-settings create mode 100644 tutorpicasso/patches/openedx-development-settings create mode 100644 tutorpicasso/patches/openedx-dockerfile-pre-assets create mode 100644 tutorpicasso/patches/openedx-lms-production-settings diff --git a/tutorpicasso/patches/cms-env b/tutorpicasso/patches/cms-env new file mode 100644 index 0000000..ad8b8d9 --- /dev/null +++ b/tutorpicasso/patches/cms-env @@ -0,0 +1,3 @@ +{%- if PICASSO_DEFAULT_SITE_THEME is defined or PICASSO_THEMES_NAME is defined %} +DEFAULT_SITE_THEME: "{{ PICASSO_DEFAULT_SITE_THEME | default(PICASSO_THEMES_NAME[0]) }}" +{% endif %} diff --git a/tutorpicasso/patches/lms-env b/tutorpicasso/patches/lms-env new file mode 100644 index 0000000..ad8b8d9 --- /dev/null +++ b/tutorpicasso/patches/lms-env @@ -0,0 +1,3 @@ +{%- if PICASSO_DEFAULT_SITE_THEME is defined or PICASSO_THEMES_NAME is defined %} +DEFAULT_SITE_THEME: "{{ PICASSO_DEFAULT_SITE_THEME | default(PICASSO_THEMES_NAME[0]) }}" +{% endif %} diff --git a/tutorpicasso/patches/openedx-cms-production-settings b/tutorpicasso/patches/openedx-cms-production-settings new file mode 100644 index 0000000..d1c601c --- /dev/null +++ b/tutorpicasso/patches/openedx-cms-production-settings @@ -0,0 +1,6 @@ +{% if PICASSO_THEMES is defined -%} +ENABLE_COMPREHENSIVE_THEMING = True +{%- endif %} +{% if PICASSO_THEME_DIRS is defined -%} +COMPREHENSIVE_THEME_DIRS.extend({{ PICASSO_THEME_DIRS }}) +{%- endif %} diff --git a/tutorpicasso/patches/openedx-common-assets-settings b/tutorpicasso/patches/openedx-common-assets-settings new file mode 100644 index 0000000..7645076 --- /dev/null +++ b/tutorpicasso/patches/openedx-common-assets-settings @@ -0,0 +1,3 @@ +{%- if PICASSO_THEME_DIRS is defined %} +COMPREHENSIVE_THEME_DIRS.extend({{ PICASSO_THEME_DIRS }}) +{%- endif %} diff --git a/tutorpicasso/patches/openedx-development-settings b/tutorpicasso/patches/openedx-development-settings new file mode 100644 index 0000000..8404f25 --- /dev/null +++ b/tutorpicasso/patches/openedx-development-settings @@ -0,0 +1,6 @@ +{% if PICASSO_THEMES is defined -%} +ENABLE_COMPREHENSIVE_THEMING = True +{%- endif %} +{%- if PICASSO_THEME_DIRS is defined %} +COMPREHENSIVE_THEME_DIRS.extend({{ PICASSO_THEME_DIRS }}) +{%- endif %} diff --git a/tutorpicasso/patches/openedx-dockerfile-pre-assets b/tutorpicasso/patches/openedx-dockerfile-pre-assets new file mode 100644 index 0000000..01c9366 --- /dev/null +++ b/tutorpicasso/patches/openedx-dockerfile-pre-assets @@ -0,0 +1,23 @@ +{% if PICASSO_TUTOR_VERSION is defined and PICASSO_THEME_DIRS is defined and PICASSO_THEMES_NAME is defined %} +{% set redwood_version = 'v18.0.0'.lstrip('v').split('.') %} +{% set current_version = PICASSO_TUTOR_VERSION.lstrip('v').split('.') %} +{% set redwood_version = redwood_version | map('int') | list %} +{% set current_version = current_version | map('int') | list %} + +COPY --chown=app:app ./themes/ /openedx/themes +{% if (current_version[0] < redwood_version[0]) %} +# This compiles the Picasso themes assets in the releases < redwood. +RUN openedx-assets themes \ + --theme-dirs {{ PICASSO_THEME_DIRS | join(' ') }} \ + --themes {{ PICASSO_THEMES_NAME | join(' ') }} \ + && openedx-assets collect --settings=tutor.assets \ + && rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/ +{% else %} +# This compiles the Picasso themes assets from the redwood release. +RUN npm run compile-sass -- \ + --theme-dir {{ PICASSO_THEME_DIRS | join(' --theme-dir ') }} \ + --theme {{ PICASSO_THEMES_NAME | join(' --theme ') }} \ + && ./manage.py lms collectstatic --noinput --settings=tutor.assets \ + && rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/ +{% endif %} +{% endif %} diff --git a/tutorpicasso/patches/openedx-lms-production-settings b/tutorpicasso/patches/openedx-lms-production-settings new file mode 100644 index 0000000..d1c601c --- /dev/null +++ b/tutorpicasso/patches/openedx-lms-production-settings @@ -0,0 +1,6 @@ +{% if PICASSO_THEMES is defined -%} +ENABLE_COMPREHENSIVE_THEMING = True +{%- endif %} +{% if PICASSO_THEME_DIRS is defined -%} +COMPREHENSIVE_THEME_DIRS.extend({{ PICASSO_THEME_DIRS }}) +{%- endif %}