Change "Go to Course" to "Resume Course" on course home page.
ECOM-2960
This commit is contained in:
@@ -3,6 +3,7 @@ Test the course_info xblock
|
||||
"""
|
||||
import mock
|
||||
from nose.plugins.attrib import attr
|
||||
from pyquery import PyQuery as pq
|
||||
from urllib import urlencode
|
||||
|
||||
from ccx_keys.locator import CCXLocator
|
||||
@@ -94,10 +95,15 @@ class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
def test_last_accessed_courseware_not_shown(self):
|
||||
"""
|
||||
Test that the last accessed courseware link is not shown if there
|
||||
is no course content.
|
||||
"""
|
||||
SelfPacedConfiguration(enable_course_home_improvements=True).save()
|
||||
url = reverse('info', args=(unicode(self.course.id),))
|
||||
response = self.client.get(url)
|
||||
self.assertNotIn('Jump back to where you were last:', response.content)
|
||||
content = pq(response.content)
|
||||
self.assertEqual(content('.page-header-secondary a').length, 0)
|
||||
|
||||
def test_last_accessed_shown(self):
|
||||
SelfPacedConfiguration(enable_course_home_improvements=True).save()
|
||||
@@ -118,7 +124,8 @@ class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
self.client.get(section_url)
|
||||
info_url = reverse('info', args=(unicode(self.course.id),))
|
||||
info_page_response = self.client.get(info_url)
|
||||
self.assertIn('Jump back to where you were last:', info_page_response.content)
|
||||
content = pq(info_page_response.content)
|
||||
self.assertEqual(content('.page-header-secondary .last-accessed-link').attr('href'), section_url)
|
||||
|
||||
|
||||
class CourseInfoTestCaseCCX(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
|
||||
@@ -713,12 +713,9 @@ def course_info(request, course_id):
|
||||
}
|
||||
|
||||
# Get the URL of the user's last position in order to display the 'where you were last' message
|
||||
context['last_accessed_courseware'] = None
|
||||
context['last_accessed_courseware_url'] = None
|
||||
if SelfPacedConfiguration.current().enable_course_home_improvements:
|
||||
(section_module, section_url) = get_last_accessed_courseware(course, request)
|
||||
if section_module is not None and section_url is not None:
|
||||
context['last_accessed_courseware'] = section_module
|
||||
context['last_accessed_url'] = section_url
|
||||
context['last_accessed_courseware_url'] = get_last_accessed_courseware(course, request)
|
||||
|
||||
now = datetime.now(UTC())
|
||||
effective_start = _adjust_start_date_for_beta_testers(user, course, course_key)
|
||||
@@ -732,8 +729,8 @@ def course_info(request, course_id):
|
||||
|
||||
def get_last_accessed_courseware(course, request):
|
||||
"""
|
||||
Return a pair of the last-accessed courseware for this request's
|
||||
user, and a URL for that module.
|
||||
Return the URL the courseware module that this request's user last
|
||||
accessed, or None if it cannot be found.
|
||||
"""
|
||||
field_data_cache = FieldDataCache.cache_for_descriptor_descendents(
|
||||
course.id, request.user, course, depth=2
|
||||
@@ -750,8 +747,8 @@ def get_last_accessed_courseware(course, request):
|
||||
'chapter': chapter_module.url_name,
|
||||
'section': section_module.url_name
|
||||
})
|
||||
return (section_module, url)
|
||||
return (None, None)
|
||||
return url
|
||||
return None
|
||||
|
||||
|
||||
@ensure_csrf_cookie
|
||||
|
||||
@@ -23,20 +23,16 @@
|
||||
}
|
||||
|
||||
.page-header-secondary {
|
||||
@include float(right);
|
||||
display: inline-block;
|
||||
width: flex-grid(4, 12);
|
||||
margin: 0;
|
||||
margin: ($baseline/2);
|
||||
padding: ($baseline/2) ($baseline*0.75);
|
||||
border: 1px solid $blue;
|
||||
background-color: $homepage-background;
|
||||
@extend %t-title8;
|
||||
color: $blue-d1;
|
||||
@extend %cont-truncated;
|
||||
vertical-align: text-bottom;
|
||||
background-color: $blue;
|
||||
border-radius: 2px;
|
||||
|
||||
.last-accessed-message {
|
||||
display: inline-block;
|
||||
@include margin-left($baseline*0.75);
|
||||
.last-accessed-link {
|
||||
@extend %t-title6;
|
||||
color: $very-light-text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,11 +54,9 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
<h1 class="page-title">${_("Welcome to {org}'s {course_name}!").format(org=course.id.org, course_name=course.id.course) | h}</h1>
|
||||
<h2 class="page-subtitle">${course.display_name | h}</h2>
|
||||
</div>
|
||||
% if last_accessed_courseware:
|
||||
% if last_accessed_courseware_url:
|
||||
<div class="page-header-secondary">
|
||||
<i class="fa fa-clock-o"></i>
|
||||
<p class="last-accessed-message">${_("Jump back to where you were last:")}</p>
|
||||
<a href="${last_accessed_url}">${last_accessed_courseware.display_name | h}</a>
|
||||
<a href="${last_accessed_courseware_url}" class="last-accessed-link">${_("Resume Course")}</a>
|
||||
</div>
|
||||
% endif
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user