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
2 changes: 1 addition & 1 deletion .hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ def update(self, metadata: dict[str, t.Any]) -> None:
def load_about() -> dict[str, str]:
about: dict[str, str] = {}
with open(os.path.join(HERE, "tutorindigo", "__about__.py"), "rt", encoding="utf-8") as f:
exec(f.read(), about) # pylint: disable=exec-used
exec(f.read(), about)
return about
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ instructions, because git commits are used to generate release notes:

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

<a id='changelog-20.0.1'></a>
## v20.0.1 (2025-09-23)

- [Improvement] Make latex response editor background colours WCAG compliant in dark theme. (by @Danyal-Faheem)

- [Improvement] Sync footer in both MFE pages and templates (by @zubairshakoorarbisoft)

<a id='changelog-20.0.0'></a>

## v20.0.0 (2025-06-16)
Expand Down
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
.DEFAULT_GOAL := help
.PHONY: docs
SRC_DIRS = ./tutorindigo
BLACK_OPTS = --exclude templates ${SRC_DIRS}

# Warning: These checks are not necessarily run on every PR.
test: test-lint test-types test-format # Run some static checks.
test: test-lint test-types test-format test-pythonpackage # Run some static checks.

test-format: ## Run code formatting tests
black --check --diff $(BLACK_OPTS)
ruff format --check --diff $(SRC_DIRS)

test-lint: ## Run code linting tests
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS}
ruff check ${SRC_DIRS}

test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}

build-pythonpackage: ## Build the "tutor-indigo" python package for upload to pypi
python -m build --sdist

test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
twine check dist/tutor_indigo-$(shell make version).tar.gz

format: ## Format code automatically
black $(BLACK_OPTS)
ruff format ${SRC_DIRS}

isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes.
isort --skip=templates ${SRC_DIRS}
fix-lint: ## Fix lint errors automatically
ruff check --fix ${SRC_DIRS}

changelog-entry: ## Create a new changelog entry.
scriv create

changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect

version: ## Print the current tutor-indigo version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorindigo", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'

ESCAPE = 
help: ## Print this help
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Improvement] Migrate from pylint and black to ruff. (by @HammadYousaf01)
19 changes: 17 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ dynamic = ["version"]
[project.optional-dependencies]
dev = [
"tutor[dev]>=20.0.0,<21.0.0",
"pylint",
"black"
"ruff",
]

[project.entry-points."tutor.plugin.v1"]
Expand Down Expand Up @@ -66,3 +65,19 @@ packages = ["/tutorindigo"]

[tool.hatch.metadata.hooks.custom]
path = ".hatch_build.py"

[tool.ruff]
exclude = ["templates", "docs/_ext"]

[tool.ruff.lint]
# E: pycodestyle errors
# I: isort
# N: pep8-naming
select = ["E", "I", "N"]

# F401: unused-import
# F841: unused-variable
# W292: missing-newline-at-end-of-file
extend-select = ["F401", "F841", "W292"]

[tool.ruff.format]
2 changes: 1 addition & 1 deletion tutorindigo/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "20.0.0"
__version__ = "20.0.1"
81 changes: 81 additions & 0 deletions tutorindigo/patches/mfe-env-config-runtime-definitions
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
if (typeof useIntl === "undefined") {
const intl = await import("@edx/frontend-platform/i18n");
globalThis.useIntl = intl.useIntl;
}

const IndigoFooter = () => {
const intl = useIntl();
const config = getConfig();

const indigoFooterNavLinks = config.INDIGO_FOOTER_NAV_LINKS || [];

const messages = {
"footer.poweredby.text": {
id: "footer.poweredby.text",
defaultMessage: "Powered by",
description: "text for the footer",
},
"footer.tutorlogo.altText": {
id: "footer.tutorlogo.altText",
defaultMessage: "Runs on Tutor",
description: "alt text for the footer tutor logo",
},
"footer.logo.altText": {
id: "footer.logo.altText",
defaultMessage: "Powered by Open edX",
description: "alt text for the footer logo.",
},
"footer.copyright.text": {
id: "footer.copyright.text",
defaultMessage: `Copyrights ©${new Date().getFullYear()}. All Rights Reserved.`,
description: "copyright text for the footer",
},
};

return (
<div className="wrapper wrapper-footer">
<footer id="footer" className="tutor-container">
<div className="footer-top">
<div className="powered-area">
<ul className="logo-list">
<li>{intl.formatMessage(messages["footer.poweredby.text"])}</li>
<li>
<a
href="https://edly.io/tutor/"
rel="noreferrer"
target="_blank"
></a>
<img
src={`${config.LMS_BASE_URL}/theming/asset/images/tutor-logo.png`}
alt={intl.formatMessage(messages["footer.tutorlogo.altText"])}
width="57"
/>
</li>
<li>
<a href="https://open.edx.org" rel="noreferrer" target="_blank">
<img
src={`${config.LMS_BASE_URL}/theming/asset/images/openedx-logo.png`}
alt={intl.formatMessage(messages["footer.logo.altText"])}
width="79"
/>
</a>
</li>
</ul>
</div>
<nav className="nav-colophon">
<ol>
{indigoFooterNavLinks.map((link) => (
<li key={link.url}>
<a href={`${config.LMS_BASE_URL}${link.url}`}>{link.title}</a>
</li>
))}
</ol>
</nav>
</div>
<span className="copyright-site">
{intl.formatMessage(messages["footer.copyright.text"])}
</span>
</footer>
</div>
);
};
19 changes: 6 additions & 13 deletions tutorindigo/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
],
)

# Force the rendering of scss files, even though they are included in a "partials" directory
# Force the rendering of scss files, even though they are included in a
# "partials" directory
hooks.Filters.ENV_PATTERNS_INCLUDE.add_items(
[
r"indigo/lms/static/sass/partials/lms/theme/",
Expand Down Expand Up @@ -113,24 +114,16 @@ def _override_openedx_docker_image(
"discussions",
]


for mfe in indigo_styled_mfes:
hooks.Filters.ENV_PATCHES.add_items(
[
(
f"mfe-dockerfile-post-npm-install-{mfe}",
"""
RUN npm install @edly-io/indigo-frontend-component-footer@^3.0.0
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^5.0.0'
RUN npm install '@edx/brand@github:@edly-io/brand-openedx#ulmo/indigo'

""",
),
(
f"mfe-env-config-runtime-definitions-{mfe}",
"""
const { default: IndigoFooter } = await import('@edly-io/indigo-frontend-component-footer');
""",
""", # noqa: E501
),
]
)
Expand Down Expand Up @@ -200,7 +193,7 @@ def _override_openedx_docker_image(
PLUGIN_SLOTS.add_item(
(
mfe,
"footer_slot",
"org.openedx.frontend.layout.footer.v1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for changing the alias to its slot ID?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move from the legacy alias footer_slot to the canonical, versioned plugin slot ID org.openedx.frontend.layout.footer.v1. The alias still works for backward compatibility, but using the fully qualified slot ID aligns with current OpenEdx conventions and helps keep the code forward-compatible.

"""
{
op: PLUGIN_OPERATIONS.Hide,
Expand All @@ -209,10 +202,10 @@ def _override_openedx_docker_image(
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'default_contents',
id: 'custom_footer',
type: DIRECT_PLUGIN,
priority: 1,
RenderWidget: <IndigoFooter />,
RenderWidget: IndigoFooter,
},
},
{
Expand Down