From cf6ea15ffffa16df9893ceea161294f08bf9644b Mon Sep 17 00:00:00 2001 From: Nathan Sprenkle Date: Thu, 9 Jun 2022 11:22:04 -0400 Subject: [PATCH] feat: add course listing alongside learner dashboard (#30553) * refactor: split programs into separate file space This is in preparation to allow learner dashboard routes/files to live alongside. * feat: add new empty course listing view * docs: update README and split out programs Co-authored-by: nsprenkle --- lms/djangoapps/learner_dashboard/PROGRAMS.rst | 56 +++++++++++++++++++ lms/djangoapps/learner_dashboard/README.rst | 55 +++++------------- .../learner_dashboard/courses_views.py | 15 +++++ .../{views.py => program_views.py} | 0 lms/djangoapps/learner_dashboard/urls.py | 16 ++++-- 5 files changed, 95 insertions(+), 47 deletions(-) create mode 100644 lms/djangoapps/learner_dashboard/PROGRAMS.rst create mode 100644 lms/djangoapps/learner_dashboard/courses_views.py rename lms/djangoapps/learner_dashboard/{views.py => program_views.py} (100%) diff --git a/lms/djangoapps/learner_dashboard/PROGRAMS.rst b/lms/djangoapps/learner_dashboard/PROGRAMS.rst new file mode 100644 index 0000000000..737afc1c7c --- /dev/null +++ b/lms/djangoapps/learner_dashboard/PROGRAMS.rst @@ -0,0 +1,56 @@ +.. _programs: + +================== +Programs Dashboard +================== + +Status: Maintenance + +Responsibilities +================ + +This Django app hosts dashboard pages used by edX learners. The intent is for +this Django app to include the following dashboard tabs: + + - Courses + - Programs + +Direction: Deprecate +==================== +This is being replaced by new UI that is in active development. New functionality should not be added here. + +Glossary +======== + +Courses +------- + +The learner-facing dashboard listing active and archived enrollments. The +current implementation of the dashboard resides in +``common/djangoapps/student/``. + +Programs +-------- + +A page listing programs in which the learner is engaged. The page also shows +learners' progress towards completing the programs. Programs are structured +collections of course runs which culminate into a certificate. + + +More Documentation +================== + +Implementation +^^^^^^^^^^^^^^ + +The ``views`` module contains the Django views used to serve the Program listing +page. The corresponding Backbone app is in the +``edx-platform/static/js/learner_dashboard``. + +Configuration +^^^^^^^^^^^^^ + +In order to turn on the Programs tab, you need to update the ``Programs API +Config`` object in the lms Django admin. Make sure you set the values +``Enabled``, ``Do we want to show program listing page`` and ``Do we want to +show xseries program advertising`` to be true diff --git a/lms/djangoapps/learner_dashboard/README.rst b/lms/djangoapps/learner_dashboard/README.rst index c77f096075..0daa4e0b45 100644 --- a/lms/djangoapps/learner_dashboard/README.rst +++ b/lms/djangoapps/learner_dashboard/README.rst @@ -1,50 +1,21 @@ -Status: Maintenance +================= +Learner dashboard +================= -Responsibilities -================ +This djangoapp houses 2 related dashboards owned and developed, currently by 2 separate teams: -This Django app hosts dashboard pages used by edX learners. The intent is for -this Django app to include the following dashboard tabs: +1. Courses Dashboard +2. Programs Dashboard - - Courses - - Programs +Courses Dashboard +================= -Direction: Deprecate -==================== -This is being replaced by new UI that is in active development. New functionality should not be added here. +The Courses section of the Learner Dashboard is a backend supporting a new MFE experience of the learner dashboard. -Glossary -======== +This aims to replace the existing dashboard at:: + /common/djangoapps/student/views/dashboard.py -Courses -------- - -The learner-facing dashboard listing active and archived enrollments. The -current implementation of the dashboard resides in -``common/djangoapps/student/``. - -Programs --------- - -A page listing programs in which the learner is engaged. The page also shows -learners' progress towards completing the programs. Programs are structured -collections of course runs which culminate into a certificate. - - -More Documentation +Programs Dashboard ================== -Implementation -^^^^^^^^^^^^^^ - -The ``views`` module contains the Django views used to serve the Program listing -page. The corresponding Backbone app is in the -``edx-platform/static/js/learner_dashboard``. - -Configuration -^^^^^^^^^^^^^ - -In order to turn on the Programs tab, you need to update the ``Programs API -Config`` object in the lms Django admin. Make sure you set the values -``Enabled``, ``Do we want to show program listing page`` and ``Do we want to -show xseries program advertising`` to be true +See :ref:`programs`.rst doc. diff --git a/lms/djangoapps/learner_dashboard/courses_views.py b/lms/djangoapps/learner_dashboard/courses_views.py new file mode 100644 index 0000000000..6d5837e11e --- /dev/null +++ b/lms/djangoapps/learner_dashboard/courses_views.py @@ -0,0 +1,15 @@ +""" +Views for the learner dashboard. +""" +from django.contrib.auth.decorators import login_required +from django.views.decorators.http import require_GET + +from common.djangoapps.util.json_request import JsonResponse + + +@login_required +@require_GET +def course_listing(request): # pylint: disable=unused-argument + """ List of courses a user is enrolled in or entitled to """ + course_cards = [] + return JsonResponse(course_cards) diff --git a/lms/djangoapps/learner_dashboard/views.py b/lms/djangoapps/learner_dashboard/program_views.py similarity index 100% rename from lms/djangoapps/learner_dashboard/views.py rename to lms/djangoapps/learner_dashboard/program_views.py diff --git a/lms/djangoapps/learner_dashboard/urls.py b/lms/djangoapps/learner_dashboard/urls.py index cba464b631..963f0050c1 100644 --- a/lms/djangoapps/learner_dashboard/urls.py +++ b/lms/djangoapps/learner_dashboard/urls.py @@ -2,14 +2,20 @@ from django.urls import path, re_path -from lms.djangoapps.learner_dashboard import programs, views +from lms.djangoapps.learner_dashboard import courses_views, programs, program_views +# Learner Dashboard Routing urlpatterns = [ - path('programs/', views.program_listing, name='program_listing_view'), - re_path(r'^programs/(?P[0-9a-f-]+)/$', views.program_details, name='program_details_view'), - re_path(r'^programs/(?P[0-9a-f-]+)/discussion/$', views.ProgramDiscussionIframeView.as_view(), + path('learner/', courses_views.course_listing, name='course_listing_view') +] + +# Program Dashboard Routing +urlpatterns += [ + path('programs/', program_views.program_listing, name='program_listing_view'), + re_path(r'^programs/(?P[0-9a-f-]+)/$', program_views.program_details, name='program_details_view'), + re_path(r'^programs/(?P[0-9a-f-]+)/discussion/$', program_views.ProgramDiscussionIframeView.as_view(), name='program_discussion'), - re_path(r'^programs/(?P[0-9a-f-]+)/live/$', views.ProgramLiveIframeView.as_view(), + re_path(r'^programs/(?P[0-9a-f-]+)/live/$', program_views.ProgramLiveIframeView.as_view(), name='program_live'), path('programs_fragment/', programs.ProgramsFragmentView.as_view(), name='program_listing_fragment_view'), re_path(r'^programs/(?P[0-9a-f-]+)/details_fragment/$', programs.ProgramDetailsFragmentView.as_view(),