diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 7cad92aa31..fb2424b127 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -127,6 +127,7 @@ from openedx.core.djangoapps.credentials.utils import get_user_program_credentia from openedx.core.djangoapps.credit.email_utils import get_credit_provider_display_names, make_providers_strings from openedx.core.djangoapps.user_api.preferences import api as preferences_api from openedx.core.djangoapps.programs.utils import get_programs_for_dashboard +from openedx.core.djangoapps.programs.models import ProgramsApiConfig log = logging.getLogger("edx.student") @@ -741,6 +742,7 @@ def dashboard(request): 'course_programs': course_programs, 'disable_courseware_js': True, 'xseries_credentials': xseries_credentials, + 'show_program_listing': ProgramsApiConfig.current().show_program_listing, } ecommerce_service = EcommerceService() diff --git a/lms/djangoapps/learner_dashboard/README.rst b/lms/djangoapps/learner_dashboard/README.rst index 7fd834058c..3eb90c472a 100644 --- a/lms/djangoapps/learner_dashboard/README.rst +++ b/lms/djangoapps/learner_dashboard/README.rst @@ -18,6 +18,11 @@ 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 + Profile --------------- A page allowing learners to see what they have accomplished and view credits or certificates they have earned on the edX platform. + diff --git a/lms/djangoapps/learner_dashboard/tests/test_programs.py b/lms/djangoapps/learner_dashboard/tests/test_programs.py index b189c62ff3..ae42b4a45e 100644 --- a/lms/djangoapps/learner_dashboard/tests/test_programs.py +++ b/lms/djangoapps/learner_dashboard/tests/test_programs.py @@ -43,7 +43,7 @@ class TestProgramListing( super(TestProgramListing, self).setUp() ClientFactory(name=ProgramsApiConfig.OAUTH2_CLIENT_NAME, client_type=CONFIDENTIAL) self.student = UserFactory() - self.create_programs_config(xseries_ad_enabled=True) + self.create_programs_config(xseries_ad_enabled=True, program_listing_enabled=True) def _create_course_and_enroll(self, student, org, course, run): """ @@ -120,13 +120,13 @@ class TestProgramListing( self.assertIn(program_element, response.content) def test_get_programs_dashboard_not_enabled(self): - self.create_programs_config(enable_student_dashboard=False) + self.create_programs_config(program_listing_enabled=False) self.client.login(username=self.student.username, password=self.PASSWORD) response = self.client.get(reverse("program_listing_view")) self.assertEqual(response.status_code, 404) def test_xseries_advertise_disabled(self): - self.create_programs_config(xseries_ad_enabled=False) + self.create_programs_config(program_listing_enabled=True, xseries_ad_enabled=False) self.client.login(username=self.student.username, password=self.PASSWORD) response = self.client.get(reverse("program_listing_view")) self.assertEqual(response.status_code, 200) diff --git a/lms/djangoapps/learner_dashboard/views.py b/lms/djangoapps/learner_dashboard/views.py index 85026a445c..503d4bfcc3 100644 --- a/lms/djangoapps/learner_dashboard/views.py +++ b/lms/djangoapps/learner_dashboard/views.py @@ -16,7 +16,8 @@ from student.views import get_course_enrollments @require_GET def view_programs(request): """View programs in which the user is engaged.""" - if not ProgramsApiConfig.current().is_student_dashboard_enabled: + show_program_listing = ProgramsApiConfig.current().show_program_listing + if not show_program_listing: raise Http404 enrollments = list(get_course_enrollments(request.user, None, [])) @@ -32,5 +33,7 @@ def view_programs(request): return render_to_response('learner_dashboard/programs.html', { 'programs': programs, - 'xseries_url': marketing_root if ProgramsApiConfig.current().show_xseries_ad else None + 'xseries_url': marketing_root if ProgramsApiConfig.current().show_xseries_ad else None, + 'nav_hidden': True, + 'show_program_listing': show_program_listing }) diff --git a/lms/static/sass/shared/_header.scss b/lms/static/sass/shared/_header.scss index c3f1e718c0..f1ee639a4e 100644 --- a/lms/static/sass/shared/_header.scss +++ b/lms/static/sass/shared/_header.scss @@ -262,7 +262,23 @@ header.global { margin-top: ($baseline/2); list-style: none; @include float(left); - + .tab-nav-item{ + display: inline; + margin: 0px; + .tab-nav-link{ + font-size: em(16); + color: $gray; + padding: 26px 15px; + display: inline; + &:hover, + &:focus{ + border-bottom: 4px solid $courseware-border-bottom-color; + } + } + .active{ + border-bottom: 4px solid $black-t3 !important; + } + } li, div { display: inline-block; @@ -337,7 +353,6 @@ header.global { } } - // edX theme: Global Header // ==================== @@ -348,7 +363,7 @@ header.global-new { @include box-sizing(border-box); position: relative; width: 100%; - border-bottom: 4px solid $courseware-border-bottom-color; + border-bottom: 1px solid $gray-l1; box-shadow: 0 1px 5px 0 $shadow-l1; background: $header-bg; @@ -377,6 +392,23 @@ header.global-new { .nav-global { @include float(left); + .tab-nav-item{ + display: inline; + margin: 0px; + .tab-nav-link{ + font-size: em(16); + color: $gray; + display: inline; + padding: 25px 15px; + &:hover, + &:focus{ + border-bottom: 4px solid $courseware-border-bottom-color; + } + } + .active{ + border-bottom: 4px solid $black-t3 !important; + } + } } .nav-account-management { diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index ea744db0a3..e2fafa9e94 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -65,11 +65,23 @@ site_status_msg = get_site_status_msg(course_id) % if user.is_authenticated():