Skip to content

Commit

Permalink
Merge pull request #101 from overhangio/sumac
Browse files Browse the repository at this point in the history
v19.0.0 Upgrade to sumac
  • Loading branch information
DawoudSheraz authored Dec 16, 2024
2 parents 5a3feae + b7a1033 commit fc4f231
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 104 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ instructions, because git commits are used to generate release notes:

<!-- scriv-insert-here -->

<a id='changelog-19.0.0'></a>
## v19.0.0 (2024-12-11)

- 💥[Feature] Upgrade to Sumac (by @hinakhadim)

<a id='changelog-18.3.0'></a>
## v18.3.0 (2024-12-11)

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ Overriding the default "about", "contact", etc. static pages

By default, the ``/about`` and ``/contact`` pages contain a simple line of text: "This page left intentionally blank. Feel free to add your own content". This is of course unusable in production. In the following, we detail how to override just any of the static templates used in Open edX.

The static templates used by Open edX to render those pages are all stored in the `edx-platform/lms/templates/static_templates <https://github.com/edx/edx-platform/tree/open-release/redwood.master/lms/templates/static_templates>`__ folder. To override those templates, you should add your own in the following folder::
The static templates used by Open edX to render those pages are all stored in the `edx-platform/lms/templates/static_templates <https://github.com/edx/edx-platform/tree/open-release/sumac.master/lms/templates/static_templates>`__ folder. To override those templates, you should add your own in the following folder::

ls tutorindigo/templates/indigo/lms/templates/static_templates"

For instance, edit the "donate.html" file in this directory. We can derive the content of this file from the contents of the `donate.html <https://github.com/edx/edx-platform/blob/open-release/redwood.master/lms/templates/static_templates/donate.html>`__ static template in edx-platform:
For instance, edit the "donate.html" file in this directory. We can derive the content of this file from the contents of the `donate.html <https://github.com/edx/edx-platform/blob/open-release/sumac.master/lms/templates/static_templates/donate.html>`__ static template in edx-platform:

.. code-block:: mako
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def load_about():
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.9",
install_requires=["tutor>=18.0.0,<19.0.0", "tutor-mfe>=18.0.0,<19.0.0"],
extras_require={"dev": "tutor[dev]>=18.0.0,<19.0.0"},
install_requires=["tutor>=19.0.0,<20.0.0", "tutor-mfe>=19.0.0,<20.0.0"],
extras_require={"dev": "tutor[dev]>=19.0.0,<20.0.0"},
entry_points={"tutor.plugin.v1": ["indigo = tutorindigo.plugin"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion tutorindigo/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "18.3.0"
__version__ = "19.0.0"
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import React, { useEffect } from 'react';
import Cookies from 'universal-cookie';

import Footer from '@edly-io/indigo-frontend-component-footer';
import { getConfig } from '@edx/frontend-platform';
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';

let themeCookie = 'indigo-toggle-dark';
let themeCookieExpiry = 90; // days
Expand Down Expand Up @@ -70,35 +65,3 @@ const AddDarkTheme = () => {

return (<div />);
};

const themePluginSlot = {
keepDefault: false,
plugins: [
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'default_contents',
type: DIRECT_PLUGIN,
priority: 1,
RenderWidget: <Footer />,
},
},
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'read_theme_cookie',
type: DIRECT_PLUGIN,
priority: 2,
RenderWidget: AddDarkTheme,
},
},
],
};

const config = {
pluginSlots: {
footer_slot: themePluginSlot,
},
};

export default config;
4 changes: 4 additions & 0 deletions tutorindigo/patches/mfe-env-config-buildtime-imports
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React, { useEffect } from 'react';
import Cookies from 'universal-cookie';

import { getConfig } from '@edx/frontend-platform';
2 changes: 2 additions & 0 deletions tutorindigo/patches/mfe-env-config-runtime-definitions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

const { default: IndigoFooter } = await import('@edly-io/indigo-frontend-component-footer');
121 changes: 68 additions & 53 deletions tutorindigo/plugin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from __future__ import annotations

import os
from glob import glob
import typing as t

import importlib_resources
from tutor import hooks
from tutormfe.hooks import PLUGIN_SLOTS
from tutor.__about__ import __version_suffix__

from .__about__ import __version__
Expand Down Expand Up @@ -102,68 +104,37 @@ def _override_openedx_docker_image(
hooks.Filters.CONFIG_OVERRIDES.add_items(list(config["overrides"].items()))


# MFEs that are styled using Indigo
indigo_styled_mfes = [
"learning",
"learner-dashboard",
"profile",
"account",
"discussions",
]

hooks.Filters.ENV_PATCHES.add_items(
[
# MFE will install header version 3.0.x and will include indigo-footer as a
# separate package for use in env.config.jsx
(
"mfe-dockerfile-post-npm-install-learning",
f"mfe-dockerfile-post-npm-install-{mfe}",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3'
RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.2.2'
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.2.2'
COPY indigo/env.config.jsx /openedx/app/
""",
),
(
"mfe-dockerfile-post-npm-install-authn",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'
""",
),
# Tutor-Indigo v2.1 targets the styling updates in discussions and learner-dashboard MFE
# brand-openedx is related to styling updates while others are for header and footer updates
(
"mfe-dockerfile-post-npm-install-discussions",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3'
RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0
COPY indigo/env.config.jsx /openedx/app/
""",
),
(
"mfe-dockerfile-post-npm-install-learner-dashboard",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'
RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0
COPY indigo/env.config.jsx /openedx/app/
""",
),
(
"mfe-dockerfile-post-npm-install-profile",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3'
RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0
)
for mfe in indigo_styled_mfes
]
)

COPY indigo/env.config.jsx /openedx/app/
""",
),
(
"mfe-dockerfile-post-npm-install-account",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3'
RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0

COPY indigo/env.config.jsx /openedx/app/
""",
),
]
hooks.Filters.ENV_PATCHES.add_item(
(
"mfe-dockerfile-post-npm-install-authn",
"RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.2.2'",
)
)

# Include js file in lms main.html, main_django.html, and certificate.html
Expand Down Expand Up @@ -204,3 +175,47 @@ def _override_openedx_docker_image(
),
]
)


# Apply patches from tutor-indigo
for path in glob(
os.path.join(
str(importlib_resources.files("tutorindigo") / "patches"),
"*",
)
):
with open(path, encoding="utf-8") as patch_file:
hooks.Filters.ENV_PATCHES.add_item((os.path.basename(path), patch_file.read()))


for mfe in indigo_styled_mfes:
PLUGIN_SLOTS.add_item(
(
mfe,
"footer_slot",
"""
{
op: PLUGIN_OPERATIONS.Hide,
widgetId: 'default_contents',
},
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'default_contents',
type: DIRECT_PLUGIN,
priority: 1,
RenderWidget: <IndigoFooter />,
},
},
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'read_theme_cookie',
type: DIRECT_PLUGIN,
priority: 2,
RenderWidget: AddDarkTheme,
},
},
""",
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
border-radius: 8px;
border: 1px solid $primary-light;
}
.play-intro{
z-index: 10;
}
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions tutorindigo/templates/indigo/lms/static/sass/xblock/_xblock.scss
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,20 @@

}

#feedback-container{
background: $body-bg-d;
border: 1px solid $text-color-d;
p{
color: $text-color-d;
}
}

.emoji-button{
background-color: $body-bg-d;
}
.xblock.xmodule_display.xmodule_HtmlBlock .blue-text{color: $primary;}


.edx-notes-wrapper{
.annotator-hl{
background: orange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
${course_discovery_meanings | n, dump_js_escaped_json},
getParameterByName('search_query'),
"${user_language | n, js_escaped_string}",
"${user_timezone | n, js_escaped_string}"
"${user_timezone | n, js_escaped_string}",
${set_default_filter | n, dump_js_escaped_json}
);
</%static:require_module>
</%block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,3 @@
</picture>
</div>
</a>
<% if (isSubscribed) { %>
<div class="subscription-badge">
<span class="badge badge-light"><%- gettext('Subscribed') %></span>
</div>
<% } %>
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@
ProgramListFactory({
marketingUrl: '${marketing_url | n, js_escaped_string}',
programsData: ${programs | n, dump_js_escaped_json},
programsSubscriptionData: ${programs_subscription_data | n, dump_js_escaped_json},
subscriptionUpsellData: ${subscription_upsell_data | n, dump_js_escaped_json},
userProgress: ${progress | n, dump_js_escaped_json},
userPreferences: ${user_preferences | n, dump_js_escaped_json},
isUserB2CSubscriptionsEnabled: ${is_user_b2c_subscriptions_enabled | n, dump_js_escaped_json},
mobileOnly: ${mobile_only | n, dump_js_escaped_json}
});
</%static:webpack>
Expand Down

0 comments on commit fc4f231

Please sign in to comment.