Skip to content

Commit f3833ea

Browse files
committed
feat: Install brand-sample from tutor-contrib-sample
1 parent b1d9736 commit f3833ea

2 files changed

Lines changed: 33 additions & 56 deletions

File tree

brand-sample/README.md

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,60 +16,6 @@
1616
> * **Open edX "Teak" release or later (Tutor >= 20)**
1717
> * **Tutor >= 20**
1818
19-
### Configure `tutor` to use this theme
19+
## TODO
2020

21-
#### Using the [`jsdelivr`](https://www.jsdelivr.com/) CDN (Recommended)
22-
23-
1. Stop `tutor` (`tutor dev stop` or `tutor local stop`)
24-
2. Navigate to your local tutor plugins directory (`tutor plugins printroot`)
25-
3. Create a new `sample-jsdelivr.py` plugin file with the following content
26-
27-
```py
28-
import json
29-
from tutor import hooks
30-
31-
paragon_theme_urls = {
32-
"variants": {
33-
"light": {
34-
"urls": {
35-
"default": "https://cdn.jsdelivr.net/npm/@openedx/paragon@$paragonVersion/dist/light.min.css",
36-
"brandOverride": "https://cdn.jsdelivr.net/gh/openedx/sample-plugin@main/brand-sample/dist/light.min.css"
37-
}
38-
}
39-
}
40-
}
41-
42-
fstring = f"""
43-
MFE_CONFIG["PARAGON_THEME_URLS"] = {json.dumps(paragon_theme_urls)}
44-
"""
45-
46-
hooks.Filters.ENV_PATCHES.add_item(
47-
(
48-
"mfe-lms-common-settings",
49-
fstring
50-
)
51-
)
52-
```
53-
54-
4. Enable the plugin (`tutor plugins enable sample-jsdelivr`)
55-
5. Start `tutor` (`tutor dev start lms cms mfe` or `tutor local start lms cms mfe`)
56-
57-
#### Using the [Tutor Paragon Plugin](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon) (Recommended)
58-
59-
1. [Install](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#installation) and [enable](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#enable-the-plugin) the Tutor Paragon Plugin (`tutor-contrib-paragon`)
60-
2. [Build](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#build-the-paragon-image) the `paragon-builder` image.
61-
2. Navigate to your Tutor config directory (you can find this by running `tutor config printroot`)
62-
3. From your config directory, navigate to `env/plugins/paragon` (the full path on my dev machine is `~/.local/share/tutor-main/env/plugins/paragon`)
63-
4. You should see some directories in there, find the `theme-sources` directory.
64-
5. Place this theme's [`color.json` file](./src/tokens/src/themes/light/global/color.json) in the appropriate subdirectory of the `theme-sources` directory.
65-
```sh
66-
$ tree ~/.local/share/tutor-main/env/plugins/paragon
67-
├── [...]
68-
└── theme-sources
69-
└── themes
70-
└── light
71-
└── global
72-
└── color.json
73-
```
74-
6. [Build](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#build-all-themes) the theme
75-
7. Start `tutor` (`tutor dev start lms cms mfe` or `tutor local start lms cms mfe`)
21+
Update this readme now that most of the instructions were moved into plugin.py

tutor-contrib-sample/tutorsample/plugin.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
tutor>=17.0.0
1010
tutor-mfe (for frontend slot configuration)
1111
"""
12+
import json
1213

1314
from tutor import hooks
1415

@@ -93,3 +94,33 @@
9394
},
9495
}""",
9596
))
97+
98+
# ---------------------------------------------------------------------------
99+
# Brand
100+
# ---------------------------------------------------------------------------
101+
# TODO: This assumes brand-sample has been pushed to jsdeliver.
102+
# Is it possible to set this up for dev so that it loads the brand from
103+
# the filesystem instead?
104+
# ---------------------------------------------------------------------------
105+
106+
paragon_theme_urls = {
107+
"variants": {
108+
"light": {
109+
"urls": {
110+
"default": "https://cdn.jsdelivr.net/npm/@openedx/paragon@$paragonVersion/dist/light.min.css",
111+
"brandOverride": "https://cdn.jsdelivr.net/gh/openedx/sample-plugin@main/brand-sample/dist/light.min.css"
112+
}
113+
}
114+
}
115+
}
116+
117+
settings_lines = f"""
118+
MFE_CONFIG["PARAGON_THEME_URLS"] = {json.dumps(paragon_theme_urls)}
119+
"""
120+
121+
hooks.Filters.ENV_PATCHES.add_item(
122+
(
123+
"mfe-lms-common-settings",
124+
settings_lines,
125+
)
126+
)

0 commit comments

Comments
 (0)