Add some links to student records

Add some waffle-guarded connection points to the Credentials service
to start filling out the user flow for Student Records.

Specifically, add a button to the Program Progress Details page if
a certificate exists, and add a link in the Learner Profile page.

Both only appear if the 'student_records' waffle switch is active.

LEARNER-4701
This commit is contained in:
Michael Terry
2018-04-26 13:48:59 -04:00
committed by Michael Terry
parent 4297c999c4
commit 502287b07e
13 changed files with 82 additions and 2 deletions

View File

@@ -33,6 +33,10 @@ from openedx.core.djangolib.markup import HTML
${_('Build out your profile to personalize your identity on {platform_name}.').format(
platform_name=platform_name,
)}
% if records_url:
## We don't translate this yet because we know it's not the final string
<p>To view and share your program records, go to <a href="${records_url}">My Records</a>.</p>
% endif
</div>
</div>
% endif

View File

@@ -4,8 +4,10 @@
import datetime
import ddt
import mock
from waffle.testutils import override_switch
from lms.djangoapps.certificates.tests.factories import GeneratedCertificateFactory # pylint: disable=import-error
from lms.envs.test import CREDENTIALS_PUBLIC_SERVICE_URL
from course_modes.models import CourseMode
from django.conf import settings
from django.core.urlresolvers import reverse
@@ -20,6 +22,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
@ddt.ddt
@override_switch('student_records', True)
class LearnerProfileViewTest(UrlResetMixin, ModuleStoreTestCase):
""" Tests for the student profile view. """
@@ -110,6 +113,11 @@ class LearnerProfileViewTest(UrlResetMixin, ModuleStoreTestCase):
for attribute in self.CONTEXT_DATA:
self.assertIn(attribute, response.content)
def test_records_link(self):
profile_path = reverse('learner_profile', kwargs={'username': self.USERNAME})
response = self.client.get(path=profile_path)
self.assertContains(response, '<a href="{}/records/">'.format(CREDENTIALS_PUBLIC_SERVICE_URL))
def test_undefined_profile_page(self):
"""
Verify that a 404 is returned for a non-existent profile page.

View File

@@ -12,6 +12,7 @@ from django.utils.translation import ugettext as _
from django.views.decorators.http import require_http_methods
from django_countries import countries
from edxmako.shortcuts import marketing_link
from openedx.core.djangoapps.credentials.utils import get_credentials_records_url
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.user_api.accounts.api import get_account_settings
@@ -139,6 +140,7 @@ def learner_profile_context(request, profile_username, user_is_staff):
'show_dashboard_tabs': True,
'disable_courseware_js': True,
'nav_hidden': True,
'records_url': get_credentials_records_url(),
}
if badges_enabled():