feat!: Change the way tabs are ordered [BD-38] [TNL-9174] [BB-5076] (#29262)
* feat!: Change the way tabs are ordered The change imposes a new ordering for tabs based on their new priority. When reordering tabs, this ordering will be maintained. * fix: Apply suggestions from code review Co-authored-by: Farhaan Bukhsh <farhaan@opencraft.com> * fix: review feedback Co-authored-by: Farhaan Bukhsh <farhaan@opencraft.com>
This commit is contained in:
@@ -18,6 +18,7 @@ class CcxCourseTab(CourseTab):
|
||||
"""
|
||||
|
||||
type = "ccx_coach"
|
||||
priority = 310
|
||||
title = gettext_noop("CCX Coach")
|
||||
view_name = "ccx_coach_dashboard"
|
||||
is_dynamic = True # The CCX view is dynamically added to the set of tabs when it is enabled
|
||||
|
||||
@@ -20,6 +20,7 @@ class WikiTab(EnrolledTab):
|
||||
view_name = "course_wiki"
|
||||
is_hideable = True
|
||||
is_default = False
|
||||
priority = 70
|
||||
|
||||
def __init__(self, tab_dict):
|
||||
# Default to hidden
|
||||
|
||||
@@ -34,7 +34,7 @@ class CoursewareTab(EnrolledTab):
|
||||
"""
|
||||
type = 'courseware'
|
||||
title = gettext_noop('Course')
|
||||
priority = 10
|
||||
priority = 11
|
||||
view_name = 'courseware'
|
||||
is_movable = False
|
||||
is_default = False
|
||||
@@ -69,7 +69,7 @@ class CourseInfoTab(CourseTab):
|
||||
"""
|
||||
type = 'course_info'
|
||||
title = gettext_noop('Home')
|
||||
priority = 20
|
||||
priority = 10
|
||||
view_name = 'info'
|
||||
tab_id = 'info'
|
||||
is_movable = False
|
||||
@@ -86,7 +86,7 @@ class SyllabusTab(EnrolledTab):
|
||||
"""
|
||||
type = 'syllabus'
|
||||
title = gettext_noop('Syllabus')
|
||||
priority = 30
|
||||
priority = 80
|
||||
view_name = 'syllabus'
|
||||
allow_multiple = True
|
||||
is_default = False
|
||||
@@ -104,7 +104,7 @@ class ProgressTab(EnrolledTab):
|
||||
"""
|
||||
type = 'progress'
|
||||
title = gettext_noop('Progress')
|
||||
priority = 40
|
||||
priority = 20
|
||||
view_name = 'progress'
|
||||
is_hideable = True
|
||||
is_default = False
|
||||
@@ -153,7 +153,7 @@ class TextbookTabs(TextbookTabsBase):
|
||||
A tab representing the collection of all textbook tabs.
|
||||
"""
|
||||
type = 'textbooks'
|
||||
priority = None
|
||||
priority = 200
|
||||
view_name = 'book'
|
||||
|
||||
@classmethod
|
||||
@@ -177,7 +177,7 @@ class PDFTextbookTabs(TextbookTabsBase):
|
||||
A tab representing the collection of all PDF textbook tabs.
|
||||
"""
|
||||
type = 'pdf_textbooks'
|
||||
priority = None
|
||||
priority = 201
|
||||
view_name = 'pdf_book'
|
||||
|
||||
@classmethod
|
||||
@@ -196,7 +196,7 @@ class HtmlTextbookTabs(TextbookTabsBase):
|
||||
A tab representing the collection of all Html textbook tabs.
|
||||
"""
|
||||
type = 'html_textbooks'
|
||||
priority = None
|
||||
priority = 202
|
||||
view_name = 'html_book'
|
||||
|
||||
@classmethod
|
||||
@@ -285,7 +285,7 @@ class ExternalLinkCourseTab(LinkTab):
|
||||
A course tab containing an external link.
|
||||
"""
|
||||
type = 'external_link'
|
||||
priority = None
|
||||
priority = 110
|
||||
is_default = False # An external link tab is not added to a course by default
|
||||
allow_multiple = True
|
||||
|
||||
@@ -326,9 +326,9 @@ class DatesTab(EnrolledTab):
|
||||
A tab representing the relevant dates for a course.
|
||||
"""
|
||||
type = "dates"
|
||||
title = gettext_noop(
|
||||
"Dates") # We don't have the user in this context, so we don't want to translate it at this level.
|
||||
priority = 50
|
||||
# We don't have the user in this context, so we don't want to translate it at this level.
|
||||
title = gettext_noop("Dates")
|
||||
priority = 30
|
||||
view_name = "dates"
|
||||
is_dynamic = True
|
||||
|
||||
|
||||
@@ -767,12 +767,7 @@ class CourseInfoTabTestCase(TabTestCase):
|
||||
def test_default_tab(self):
|
||||
# Verify that the course info tab is the first tab
|
||||
tabs = get_course_tab_list(self.user, self.course)
|
||||
# So I know this means course_info is not the first tab, but it is going to be
|
||||
# retired soon (https://openedx.atlassian.net/browse/TNL-7061) and also it has
|
||||
# a lower priority than courseware so seems odd that it would ever be first.
|
||||
# As such, I feel comfortable updating this test so it passes until it is removed
|
||||
# as part of the linked ticket
|
||||
assert tabs[1].type == 'course_info'
|
||||
assert tabs[0].type == 'course_info'
|
||||
|
||||
@override_waffle_flag(DISABLE_UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
def test_default_tab_for_new_course_experience(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class DiscussionTab(TabFragmentViewMixin, EnrolledTab):
|
||||
|
||||
type = 'discussion'
|
||||
title = gettext_noop('Discussion')
|
||||
priority = None
|
||||
priority = 40
|
||||
view_name = 'forum_form_discussion'
|
||||
fragment_view_name = 'lms.djangoapps.discussion.views.DiscussionBoardFragmentView'
|
||||
is_hideable = settings.FEATURES.get('ALLOW_HIDING_DISCUSSION_TAB', False)
|
||||
|
||||
@@ -26,6 +26,7 @@ class EdxNotesTab(EnrolledTab):
|
||||
type = "edxnotes"
|
||||
title = _("Notes")
|
||||
view_name = "edxnotes"
|
||||
priority = 50
|
||||
|
||||
@classmethod
|
||||
def is_enabled(cls, course, user=None):
|
||||
|
||||
@@ -81,6 +81,7 @@ class InstructorDashboardTab(CourseTab):
|
||||
title = gettext_noop('Instructor')
|
||||
view_name = "instructor_dashboard"
|
||||
is_dynamic = True # The "Instructor" tab is instead dynamically added when it is enabled
|
||||
priority = 300
|
||||
|
||||
@classmethod
|
||||
def is_enabled(cls, course, user=None):
|
||||
|
||||
@@ -28,6 +28,7 @@ class TeamsTab(EnrolledTab):
|
||||
type = "teams"
|
||||
title = _("Teams")
|
||||
view_name = "teams_dashboard"
|
||||
priority = 60
|
||||
|
||||
@classmethod
|
||||
def is_enabled(cls, course, user=None):
|
||||
|
||||
Reference in New Issue
Block a user