Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This document describes how to extend the edX platform with a new tab that can be added to courses.

...

The edX platform provides a Python entry point to allow new course tabs to be registered as plugins. We At a high level, we recommend that you implement do the following:

  • Implement your new feature as its own Django app following these guidelines: How to add a new feature to LMS or Studio
    • For now, this Django app must live inside the edx-platform repo as your plugin must subclass CourseTab or one of its subclasses
    • We hope to remove this restriction soon by moving this subclass into a separate edx-core repo
      •  See: 
        Jira Legacy
        serverJIRA (openedx.

...

The course stores a static list of its tabs in the database, and this list is only updated when one of the following actions take place:

  1. You create a new course
  2. You update the advanced settings for your course

...

      • atlassian.net)
        serverId13fd1930-5608-3aac-a5dd-21b934d3a4b4
        keyPLAT-1148
    • Our current recommendation is to place your new Django app in the folder openedx/features.
  • Render the tab as a Web Fragment, as this has a number of benefits:
    • Allows your tab to be rendered standalone in the mobile apps
    • Allows alternate LMS implementations to dynamically render your fragment as part of a single page application
    • Removes the need for your template to render the full page using Mako in order to include the platform's main.html template 
    • Potentially allows your feature to live outside of the edx-platform repo (although this is not currently possible due to the dependency upon the CourseTab base class)

The following is a more detailed list of the steps required to add a new course tab.

1. Add an entry point like this to your Python library's setup.py

Note that new_tab is the id of your tab, and example.NewTab is the fully qualified name of your new tab class.

...

MethodSignatureDescription
is_enabled
def is_enabled(cls, course, user=None)
Returns true if this tab is enabled for the current course for the specified user. If user is None, this method is being called by Studio and should generally return True if the tab will be shown to at least some students.
validate
def validate(cls, tab_dict, raise_error=True)
Validates a dictionary representing a course tab. If raise_error then issues are raised as exceptions, else the function should return True if the dictionary is valid.
Note

The course stores a static list of its tabs in the database, and this list is only updated when one of the following actions take place:

  1. You create a new course
  2. You update the advanced settings for your course

This means that if you have a pre-existing course then it won't immediately show a tab even after you've registered the new entry point.

3. Implement the view

You have two choices to implement your new tab view:

...

If your new tab type isn't returned then that means that the entry point registration didn't work. 

  • Try the following:
    • check that you registered your new tab in setup.py. 
    • If you added your new Django app into edx-platform, then add it here:
    • make sure that you've increased the version number so that pip knows that it needs to reinstall
    • try manually reinstalling the app. For an edx-platform extension, do the following in devstack:
      • No Format
        sudo su edxapp
        pip install -e /edx/app/edxapp/edx-platform

...