An Open edX backend plugin that provides a way to embed links to the course content stored in Git repositories as HTML files in the Open Learning XML format.
The plugin implements an openedx-filters pipeline that hooks into the VerticalBlockChildRenderStarted event on the VerticalBlock XBlock.
The pipeline modifies the HTML content of HTMLBlock to add necessary HTML that renders an Edit on Git link on top of each child of the VerticalBlock.
In order for this plugin to be used effectively the course content should be stored in a public repostiory in the Open Learning XML format. This allows the plugin to link each section of the course content to it's corresponding HTML file by automatically appending the filenames to the base URL of the repository.
- Install the plugin by adding
git+https://github.com/open-craft/openedx-edit-links.gitto yourEDXAPP_EXTRA_REQUIREMENTSof your deployment. On Tutor, this can be accomplished by
tutor config save --append OPENEDX_EXTRA_PIP_REQUIREMENTS=git+https://github.com/open-craft/openedx-edit-links.gitConfigure the plugin variables by setting the the following 2 values
EDIT_LINKS_PLUGIN_GIT_REPOS- a map of course IDs and the correspondint Git URLs. This URLs used here would be considered as the base of thecoursefolder of the course content. For eg.,EDIT_LINKS_PLUGIN_GIT_REPOS = { "course-v1:OpenedX+DemoX+DemoCourse": "https://github.com/openedx/openedx-demo-course/edit/master/demo-course/course/", }
EDIT_LINKS_PLUGIN_GIT_EDIT_LABEL- an OPTIONAL configuration which lets you specify the word to use in the linksEdit on <label>. Defaults to Git.EDIT_LINKS_PLUGIN_GIT_EDIT_LABEL = "Gitlab"
Configure
openedx-filtersto run the plugin's pipelineOPEN_EDX_FILTERS_CONFIG = { "org.openedx.learning.vertical_block_child.render.started.v1": { "fail_silently": False, "pipeline": [ "edit_links.pipeline.AddEditLink" ] } }
Note: The base URL in the configuration should point the OLX course directory in your Git repo. The plugin adds /html/<filename.html> to take the user to the relevant file.
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_item(
(
"openedx-common-settings",
"""
EDIT_LINKS_PLUGIN_GIT_REPOS = {
"course-v1:OpenedX+DemoX+DemoCourse": "https://github.com/openedx/openedx-demo-course/edit/master/demo-course/course/",
}
EDIT_LINKS_PLUGIN_GIT_EDIT_LABEL = "Github"
OPEN_EDX_FILTERS_CONFIG = {
"org.openedx.learning.vertical_block_child.render.started.v1": {
"fail_silently": False,
"pipeline": [
"edit_links.pipeline.AddEditLink"
]
}
}
"""),
)The plugin can be developed using a Tutor dev environment.
- Clone the repo.
- Add the repo as a Tutor mount.
tutor mounts add /path/to/openedx-edit-links. - Rebuild the
openedx-devimage.tutor images build openedx-dev. - Create a Tutor plugin based the example above and enable it.
- Restart the services.
Now the edit links should to become available in the course. Any changes to the plugin should restart the LMS service.
# Grab the latest code
git checkout main
git pull
# Install/update the dev requirements
make requirements
# Run the tests and quality checks (to verify the status before you make any changes)
make validate
# Make a new branch for your changes
git checkout -b <your_github_username>/<short_description>
# Using your favorite editor, edit the code to make your change.
vim …
# Run your new tests
pytest ./path/to/new/tests
# Run all the tests and quality checks
make validate
# Commit all your changes
git commit …
git push
# Open a PR and ask for review.The code in this repository is licensed under the AGPL 3.0 unless otherwise noted.
Please see LICENSE.txt for details.
Contributions are very welcome.
Please read How To Contribute for details.
Even though they were written with openedx-platform in mind, the guidelines
should be followed for all Open edX projects.
The pull request description template should be automatically applied if you are creating a pull request from GitHub. Otherwise you can find it at PULL_REQUEST_TEMPLATE.md.
The issue report template should be automatically applied if you are creating an issue on GitHub as well. Otherwise you can find it at ISSUE_TEMPLATE.md.
Please do not report security issues in public. Please email security@edx.org.
If you're having trouble, we have discussion forums at https://discuss.openedx.org where you can connect with others in the community.
Our real-time conversations are on Slack. You can join our community Slack workspace.
For more information about these options, see the Getting Help page.