Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
0c1dc272
Commit
0c1dc272
authored
Jan 05, 2016
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change "Go to Course" to "Resume Course" on course home page.
ECOM-2960
parent
77aa0754
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
27 deletions
+25
-27
lms/djangoapps/courseware/tests/test_course_info.py
+9
-2
lms/djangoapps/courseware/views.py
+6
-9
lms/static/sass/course/_info.scss
+8
-12
lms/templates/courseware/info.html
+2
-4
No files found.
lms/djangoapps/courseware/tests/test_course_info.py
View file @
0c1dc272
...
...
@@ -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
):
...
...
lms/djangoapps/courseware/views.py
View file @
0c1dc272
...
...
@@ -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
...
...
lms/static/sass/course/_info.scss
View file @
0c1dc272
...
...
@@ -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
;
.last-accessed-message
{
display
:
inline-block
;
@include
margin-left
(
$baseline
*
0
.75
);
background-color
:
$blue
;
border-radius
:
2px
;
.last-accessed-link
{
@extend
%t-title6
;
color
:
$very-light-text
;
}
}
}
...
...
lms/templates/courseware/info.html
View file @
0c1dc272
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment