Implement "Edit on Git" link for each section#1
Conversation
The first feature commit to the edit_links Open edX extension. * Adds a model with admin view to configure course specfiic repositories and the base_url to the edit interfaces of the source code hosting services that hold the course information. * Implements the pipeline for `org.openedx.learning.xblock.render.started.v1` event, that can generate the "Edit this on <some-service>" links to the XBlocks based on the XBlock IDs
|
@tecoholic We should probably get two edit links or open both the files in online ide for cases of a single section divided into two files like below. What do you think? This chapter corresponds to two files in the repo: |
@navinkarkera I am not really sure how to handle this situation. From the UX point of view I see the following issues:
Since this is a PoC, I am thinking opening the first file should be sufficient. Multiple file support can be added later. |
|
@navinkarkera I have updated the PR with new changes, including re-implementing the filter following the guidelines from this issue description relating to configuration, readme documentation and translations. Kindly review when you have the time. |
|
@tecoholic LGTM 👍, we just need to make sure that the tests pass. (Adding Just one question, Where can I find the source code for
|
|
@navinkarkera Thanks fore reviewing this.
Good catch. I will implement it.
It is custom class created by the XBlock Runtime using the Mixologist. It takes the HTMLXBlock and resolves the extra mixins and generates a new class with the name "HTMLBlock" + "WithMixins". |
|
The PR will be merged once the dependencies on openedx-filters are merged and its version is set in the requirements. |
| EDIT_LINKS_PLUGIN_GIT_REPOS = { | ||
| "course-v1:my+awesome+course": "https://gitlab.com/awesome-course/-/tree/master/course/", | ||
| "course-v1:foss+course+2022": "https://gitlab.com/foss-course/-/tree/master/2022/course/", | ||
| } |
There was a problem hiding this comment.
If you want, you could also make it so users can configure this per-course in Studio.
If you enable ENABLE_OTHER_COURSE_SETTINGS , the Studio Advanced Settings page will show "Other Course Settings", and you could put the URL in there like { "git_repo": "https://gitlab.com/awesome-course/-/tree/master/course/" }
No need to change anything for now, but if people want an easier way to configure this in the future, that's what I'd recommend.
Instead of replacing the HTMLBlock's data, this commit replaces the get_html function with a wrapped function which adds the edit link to the html. This lets us avoid using protected function to clean dirty fields.



Description
The first feature functional PR to the edit_links Open edX extension.
and the base_url to the edit interfaces of the source code hosting
services that hold the course information.
org.openedx.learning.vertical_block_child.render.started.v1event, that cangenerate the "Edit this on " links to the XBlocks based
on the XBlock IDs
JIRA:
Dependencies:
Installation instructions:
This assumes you are testing this on a devstack.
srcfolder and checkout to the corresponding PR branchsrcdirectory in your devstack setup and checkout to the PR branchlms/envs/private.pyofedx-platformmake lms-restartTesting instructions:
One the extension is installed and configured as above, we can test the extension using the MOOC FLOSS course content.
coursefolder from https://gitlab.com/mooc-floss/mooc-floss/-/tree/master/course as a.tar.gzfile..tar.gzfile just downloaded.course-v1:FLOSS+OSS101+2022_T4EDIT_LINKS_PLUGIN_GIT_REPOSvalue inprivate.pyto look like the following (use your course's ID)Reviewers:
cc: @antoviaque @pomegranited
Merge checklist:
Post merge:
finished.
Author concerns:
We use a protected method of the XBlock to keep the HTML of the Edit Link from raising error due to XBlock's render function auto-saving any changes.