Skip to content

Commit

Permalink
feat: upgrade to quince
Browse files Browse the repository at this point in the history
From now on, the theme will be automatically set when no other theme is already
enabled.

See overhangio/tutor#953
  • Loading branch information
hinakhadim authored and regisb committed Dec 11, 2023
1 parent 9c4d56d commit ea08b58
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
variables:
TUTOR_PLUGIN: indigo
TUTOR_PYPI_PACKAGE: tutor-indigo
TUTOR_BUILD_IMAGE: openedx
OPENEDX_RELEASE: palm
TUTOR_IMAGES: openedx
OPENEDX_RELEASE: quince
GITHUB_REPO: overhangio/tutor-indigo

include:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ instructions, because git commits are used to generate release notes:

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

<a id='changelog-17.0.0'></a>
## v17.0.0 (2023-12-09)

- 💥[Feature] Upgrade to Quince (by @hinakhadim)
- [Improvement] Add a scriv-compliant changelog. (by @regisb)
- [Improvement] Added Makefile and test action to repository and formatted code with Black and isort. (by @CodeWithEmad)


19 changes: 4 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ Indigo is an elegant, customizable theme for `Open edX <https://open.edx.org>`__
.. image:: ./screenshots/01-landing-page.png
:alt: Platform landing page

**Note**: This version of the Indigo theme is compatible with the Palm release of Open edX.

You can view the theme in action at https://demo.openedx.edly.io.

Installation
Expand All @@ -19,17 +17,9 @@ Install and enable Indigo plugin::

tutor plugins install indigo
tutor plugins enable indigo
tutor config save

Rebuild the Openedx docker image::

tutor images build openedx
tutor local launch

Restart your platform::

tutor local start -d

You will then have to enable the "indigo" theme, as per the `Tutor documentation <https://docs.tutor.edly.io/local.html#setting-a-new-theme>`__::
The Indigo theme will be automatically enabled if you have not previously defined a theme. To override an existing theme, use the `settheme command <https://docs.tutor.edly.io/local.html#setting-a-new-theme>`__::

tutor local do settheme indigo

Expand Down Expand Up @@ -67,7 +57,6 @@ Any change you make to the theme can be viewed immediately in development mode (

To deploy your changes to production, you will have to rebuild the "openedx" Docker image and restart your containers::

tutor config save
tutor images build openedx
tutor local start -d

Expand All @@ -87,11 +76,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/palm.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/quince.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/palm.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/quince.master/lms/templates/static_templates/donate.html>`__ static template in edx-platform::

<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
Expand Down
1 change: 0 additions & 1 deletion changelog.d/20230519_161836_regis.md

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/20231004_141354_codewithemad.md

This file was deleted.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def load_about():
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.8",
install_requires=["tutor>=16.0.0,<17.0.0"],
extras_require={"dev": "tutor[dev]>=16.0.0,<17.0.0"},
install_requires=["tutor>=17.0.0,<18.0.0"],
extras_require={"dev": "tutor[dev]>=17.0.0,<18.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__ = "16.0.0"
__version__ = "17.0.0"
30 changes: 30 additions & 0 deletions tutorindigo/plugin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import annotations

import os
import typing as t

import pkg_resources
Expand Down Expand Up @@ -53,6 +56,33 @@
r"indigo/lms/static/sass/partials/lms/theme/"
)

# init script: set theme automatically
with open(
os.path.join(
pkg_resources.resource_filename("tutorindigo", "templates"),
"indigo",
"tasks",
"init.sh",
),
encoding="utf-8",
) as task_file:
hooks.Filters.CLI_DO_INIT_TASKS.add_item(("lms", task_file.read()))


# Override openedx docker image name
@hooks.Filters.CONFIG_DEFAULTS.add()
def _override_openedx_docker_image(
items: list[tuple[str, t.Any]]
) -> list[tuple[str, t.Any]]:
image = ""
for k, v in items:
if k == "DOCKER_IMAGE_OPENEDX":
image = v
if image:
items.append(("DOCKER_IMAGE_OPENEDX", f"{image}-indigo"))
return items


# Load all configuration entries
hooks.Filters.CONFIG_DEFAULTS.add_items(
[(f"INDIGO_{key}", value) for key, value in config["defaults"].items()]
Expand Down
17 changes: 17 additions & 0 deletions tutorindigo/templates/indigo/tasks/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Assign themes only if no other theme exists yet
./manage.py lms shell -c "
import sys
from django.contrib.sites.models import Site
def assign_theme(domain):
site, _ = Site.objects.get_or_create(domain=domain)
if not site.themes.exists():
site.themes.create(theme_dir_name='indigo')
assign_theme('{{ LMS_HOST }}')
assign_theme('{{ LMS_HOST }}')
assign_theme('{{ LMS_HOST }}:8000')
assign_theme('{{ CMS_HOST }}')
assign_theme('{{ CMS_HOST }}:8001')
assign_theme('{{ PREVIEW_LMS_HOST }}')
assign_theme('{{ PREVIEW_LMS_HOST }}:8000')
"

0 comments on commit ea08b58

Please sign in to comment.