Skip to content

Commit 060aaa9

Browse files
committed
Initial Commit.
0 parents  commit 060aaa9

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# A Sample Plugin
2+
3+
This repository contains a sample plugin for the Open edX project that aims to
4+
provide examples for the various different plugin interfaces in the Open edX
5+
platform.
6+
7+
The `frontend` folder makes use of the frontend-plugin-framework and slots to
8+
add new components and functionality to multiple open edx frotends.
9+
10+
The `backend` folder will contain a python django app that can that can be
11+
installed alongside edx-platform and makes use of the events and filters
12+
capabilities to modify and work with existing functionality.
13+
14+
The `tutor` folder contains a tutor plugin that will install and setup both the
15+
backend and frontend plugins in a deployment of tutor.
16+
17+
# Local Development for the Frontend Plugin w/Tutor
18+
19+
When developing with tutor, it's useful to use tutor to start up the rest of
20+
the stack and then startup the specific MFE you want to develop on your local
21+
machine. We just need to tell tutor to not start the specific MFE as a part of
22+
the tutor-mfe plugin.
23+
24+
```
25+
# Example using the `learner-dashboard` MFE
26+
# Tell tutor to start this MFE in dev mode
27+
tutor dev start learner-dashbard
28+
tutor dev launch
29+
30+
# Go to the `profile` MFE folder locally.
31+
# TODO Edits needed to load our plugin locally.
32+
33+
# Start up the service
34+
npm ci
35+
npm start dev
36+
```

frontend/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "@feanil/sample-plugin",
3+
"version": "0.0.1"
4+
}

frontend/plugin.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function customCourseListPlugin(courseListData) {
2+
3+
const courses = courseListData.visibleList;
4+
// Render a list of course names
5+
return (
6+
<div>
7+
{courses.map(courseData => (
8+
<p>
9+
{courseData.course.courseName}
10+
</p>
11+
))}
12+
</div>
13+
)
14+
}

tutor/sample_plugin.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from tutormfe.hooks import PLUGIN_SLOTS
2+
3+
PLUGIN_SLOTS.add_items([
4+
# Replace the course_list
5+
(
6+
"learner-dashboard",
7+
"custom_course_list",
8+
"""
9+
{
10+
op: PLUGIN_OPERATIONS.Insert,
11+
type: DIRECT_PLUGIN,
12+
priority: 50,
13+
RenderWidget:
14+
}"""
15+
),
16+
])

0 commit comments

Comments
 (0)