Course Dashboard Visual Update

ECOM-4398
This commit is contained in:
Ahsan Ulhaq
2016-05-16 14:26:55 +05:00
parent 83155840aa
commit a8f2de8375
12 changed files with 283 additions and 203 deletions

View File

@@ -14,6 +14,7 @@ from opaque_keys.edx import locator
from provider.constants import CONFIDENTIAL
from openedx.core.djangoapps.credentials.models import CredentialsApiConfig
from openedx.core.djangoapps.credentials.tests import factories as credentials_factories
from openedx.core.djangoapps.credentials.tests.mixins import CredentialsDataMixin, CredentialsApiConfigMixin
from openedx.core.djangoapps.programs.tests.mixins import (
ProgramsApiConfigMixin,
@@ -155,18 +156,36 @@ class TestProgramListing(
'{}?next={}'.format(reverse('signin_user'), self.url)
)
# TODO: Use a factory to generate this data.
def _expected_progam_credentials_data(self):
"""
Dry method for getting expected program credentials response data.
"""
return [
credentials_factories.UserCredential(
id=1,
username='test',
credential=credentials_factories.ProgramCredential()
),
credentials_factories.UserCredential(
id=2,
username='test',
credential=credentials_factories.ProgramCredential()
)
]
def _expected_credentials_data(self):
""" Dry method for getting expected credentials."""
program_credentials_data = self._expected_progam_credentials_data()
return [
{
"display_name": "Test Program A",
"credential_url": "http://credentials.edx.org/credentials/dummy-uuid-1/"
'display_name': self.PROGRAMS_API_RESPONSE['results'][0]['name'],
'subtitle': self.PROGRAMS_API_RESPONSE['results'][0]['subtitle'],
'credential_url':program_credentials_data[0]['certificate_url']
},
{
"display_name": "Test Program B",
"credential_url": "http://credentials.edx.org/credentials/dummy-uuid-2/"
'display_name': self.PROGRAMS_API_RESPONSE['results'][1]['name'],
'subtitle':self.PROGRAMS_API_RESPONSE['results'][1]['subtitle'],
'credential_url':program_credentials_data[1]['certificate_url']
}
]

View File

@@ -7,9 +7,10 @@ from django.views.decorators.http import require_GET
from django.http import Http404
from edxmako.shortcuts import render_to_response
from openedx.core.djangoapps.credentials.utils import get_programs_credentials
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.programs.utils import ProgramProgressMeter, get_display_category
from student.views import get_course_enrollments, _get_xseries_credentials
from student.views import get_course_enrollments
@login_required
@@ -39,7 +40,7 @@ def view_programs(request):
'xseries_url': marketing_root if ProgramsApiConfig.current().show_xseries_ad else None,
'nav_hidden': True,
'show_program_listing': show_program_listing,
'credentials': _get_xseries_credentials(request.user),
'credentials': get_programs_credentials(request.user, category='xseries'),
'disable_courseware_js': True,
'uses_pattern_library': True
}