Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lms/djangoapps/instructor/views/instructor_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from xblock.field_data import DictFieldData
from xblock.fields import ScopeIds

from openedx.core.lib.instructor_dashboard_tabs import InstructorDashboardTabPluginManager
from bulk_email.api import is_bulk_email_feature_enabled
from class_dashboard.dashboard_data import get_array_section_has_problem, get_section_display_name
from course_modes.models import CourseMode, CourseModesArchive
Expand Down Expand Up @@ -234,6 +235,10 @@ def instructor_dashboard_2(request, course_id):

certificate_invalidations = CertificateInvalidation.get_certificate_invalidations(course_key)

# load externally registered sections
for Tab in InstructorDashboardTabPluginManager.get_tabs():
sections.append(Tab(course, access).to_dict())

context = {
'course': course,
'studio_url': get_studio_url(course, 'course'),
Expand Down
5 changes: 5 additions & 0 deletions openedx/core/djangoapps/course_groups/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ class CohortHandler(DeveloperErrorViewMixin, APIPermissions):
* user_partition_id: The integer identified of the UserPartition.
* group_id: The integer identified of the specific group in the partition.
"""

queryset = ''

def get(self, request, course_key_string, cohort_id=None):
"""
Endpoint to get either one or all cohorts.
Expand All @@ -528,6 +531,8 @@ def post(self, request, course_key_string, cohort_id=None):
'Please use the parent endpoint.',
'wrong-endpoint')
course_key, course = _get_course_with_access(request, course_key_string)

# TODO: add bulk import support for this
name = request.data.get('name')
if not name:
raise self.api_error(status.HTTP_400_BAD_REQUEST,
Expand Down
28 changes: 28 additions & 0 deletions openedx/core/lib/instructor_dashboard_tabs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
Tabs for the instructor dashboard.
"""
from __future__ import absolute_import

from openedx.core.lib.plugins import PluginManager


# Stevedore extension point namespaces
INSTRUCTOR_DASHBOARD_TAB_NAMESPACE = 'lms.instructor_dashboard.tab'


class InstructorDashboardTabPluginManager(PluginManager):
"""
Manager for all of the course tabs that have been made available.

TODO: develop abstract base class for tabs to implement.
"""
NAMESPACE = INSTRUCTOR_DASHBOARD_TAB_NAMESPACE

@classmethod
def get_tabs(cls):
"""
Returns the list of available tabs in their canonical order.
"""
tabs = list(cls.get_available_plugins().values())
tabs.sort(key=lambda tab: (tab.priority, tab.section_key))
return tabs