Skip to content

Commit

Permalink
fix: add patches to compile and enable themes
Browse files Browse the repository at this point in the history
  • Loading branch information
MaferMazu committed Aug 30, 2024
1 parent c1e0465 commit 5f10a56
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tutorpicasso/patches/cms-env
Original file line number Diff line number Diff line change
@@ -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 %}
3 changes: 3 additions & 0 deletions tutorpicasso/patches/lms-env
Original file line number Diff line number Diff line change
@@ -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 %}
6 changes: 6 additions & 0 deletions tutorpicasso/patches/openedx-cms-production-settings
Original file line number Diff line number Diff line change
@@ -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 %}
3 changes: 3 additions & 0 deletions tutorpicasso/patches/openedx-common-assets-settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- if PICASSO_THEME_DIRS is defined %}
COMPREHENSIVE_THEME_DIRS.extend({{ PICASSO_THEME_DIRS }})
{%- endif %}
6 changes: 6 additions & 0 deletions tutorpicasso/patches/openedx-development-settings
Original file line number Diff line number Diff line change
@@ -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 %}
23 changes: 23 additions & 0 deletions tutorpicasso/patches/openedx-dockerfile-pre-assets
Original file line number Diff line number Diff line change
@@ -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 %}
6 changes: 6 additions & 0 deletions tutorpicasso/patches/openedx-lms-production-settings
Original file line number Diff line number Diff line change
@@ -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 %}

0 comments on commit 5f10a56

Please sign in to comment.