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
a4c77054
Commit
a4c77054
authored
Mar 06, 2017
by
Brian Jacobel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add resume indicator to course outline
parent
4c8dc904
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
10 deletions
+33
-10
lms/djangoapps/courseware/views/views.py
+5
-5
lms/static/sass/features/_course-outline.scss
+8
-0
openedx/features/course_experience/templates/course_experience/course-outline-fragment.html
+14
-2
openedx/features/course_experience/views/course_outline.py
+6
-3
No files found.
lms/djangoapps/courseware/views/views.py
View file @
a4c77054
...
...
@@ -392,7 +392,7 @@ 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_url'
]
=
None
if
SelfPacedConfiguration
.
current
()
.
enable_course_home_improvements
:
context
[
'last_accessed_courseware_url'
]
=
get_last_accessed_courseware
(
course
,
request
,
user
)
context
[
'last_accessed_courseware_url'
]
,
_
=
get_last_accessed_courseware
(
course
,
request
,
user
)
now
=
datetime
.
now
(
UTC
())
effective_start
=
_adjust_start_date_for_beta_testers
(
user
,
course
,
course_key
)
...
...
@@ -427,8 +427,8 @@ def course_info(request, course_id):
def
get_last_accessed_courseware
(
course
,
request
,
user
):
"""
Return
the courseware module URL
that the user last accessed,
or
None
if it cannot be found.
Return
s a tuple containing the courseware module (URL, id)
that the user last accessed,
or
(None, None)
if it cannot be found.
"""
field_data_cache
=
FieldDataCache
.
cache_for_descriptor_descendents
(
course
.
id
,
request
.
user
,
course
,
depth
=
2
...
...
@@ -445,8 +445,8 @@ def get_last_accessed_courseware(course, request, user):
'chapter'
:
chapter_module
.
url_name
,
'section'
:
section_module
.
url_name
})
return
url
return
None
return
(
url
,
section_module
.
url_name
)
return
(
None
,
None
)
class
StaticCourseTabView
(
FragmentView
):
...
...
lms/static/sass/features/_course-outline.scss
View file @
a4c77054
...
...
@@ -43,6 +43,14 @@
text-decoration
:
none
;
}
}
&
.current
{
border
:
1px
solid
$lms-active-color
;
.resume-right
{
float
:
right
;
}
}
}
}
}
...
...
openedx/features/course_experience/templates/course_experience/course-outline-fragment.html
View file @
a4c77054
...
...
@@ -27,13 +27,25 @@ from django.utils.translation import ugettext as _
</div>
<ol
class=
"outline-item focusable"
role=
"group"
tabindex=
"0"
>
% for subsection in section.get('children') or []:
<li
class=
"subsection"
role=
"treeitem"
tabindex=
"-1"
aria-expanded=
"true"
>
<li
class=
"subsection ${ 'current' if subsection['current'] else '' }"
role=
"treeitem"
tabindex=
"-1"
aria-expanded=
"true"
>
<a
class=
"outline-item focusable"
href=
"${ subsection['lms_web_url'] }"
id=
"${ subsection['id'] }"
>
${ subsection['display_name'] }
<span>
${ subsection['display_name'] }
</span>
<span
class=
"sr-only"
>
This is your last visited course section.
</span>
% if subsection['current']:
<span
class=
"resume-right"
>
<b>
Resume Course
</b>
<span
class=
"icon fa fa-arrow-circle-right"
aria-hidden=
"true"
></span>
</span>
%endif
</a>
</li>
% endfor
...
...
openedx/features/course_experience/views/course_outline.py
View file @
a4c77054
...
...
@@ -6,6 +6,7 @@ from django.core.context_processors import csrf
from
django.template.loader
import
render_to_string
from
courseware.courses
import
get_course_with_access
from
lms.djangoapps.courseware.views.views
import
get_last_accessed_courseware
from
lms.djangoapps.course_api.blocks.api
import
get_blocks
from
opaque_keys.edx.keys
import
CourseKey
from
web_fragments.fragment
import
Fragment
...
...
@@ -18,7 +19,7 @@ class CourseOutlineFragmentView(FragmentView):
Course outline fragment to be shown in the unified course view.
"""
def
populate_children
(
self
,
block
,
all_blocks
):
def
populate_children
(
self
,
block
,
all_blocks
,
course_position
):
"""
For a passed block, replace each id in its children array with the full representation of that child,
which will be looked up by id in the passed all_blocks dict.
...
...
@@ -28,8 +29,9 @@ class CourseOutlineFragmentView(FragmentView):
for
i
in
range
(
len
(
children
)):
child_id
=
block
[
'children'
][
i
]
child_detail
=
self
.
populate_children
(
all_blocks
[
child_id
],
all_blocks
)
child_detail
=
self
.
populate_children
(
all_blocks
[
child_id
],
all_blocks
,
course_position
)
block
[
'children'
][
i
]
=
child_detail
block
[
'children'
][
i
][
'current'
]
=
course_position
==
child_detail
[
'block_id'
]
return
block
...
...
@@ -39,6 +41,7 @@ class CourseOutlineFragmentView(FragmentView):
"""
course_key
=
CourseKey
.
from_string
(
course_id
)
course
=
get_course_with_access
(
request
.
user
,
'load'
,
course_key
,
check_if_enrolled
=
True
)
_
,
course_position
=
get_last_accessed_courseware
(
course
,
request
,
request
.
user
)
course_usage_key
=
modulestore
()
.
make_course_usage_key
(
course_key
)
all_blocks
=
get_blocks
(
request
,
...
...
@@ -55,7 +58,7 @@ class CourseOutlineFragmentView(FragmentView):
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'course'
:
course
,
# Recurse through the block tree, fleshing out each child object
'blocks'
:
self
.
populate_children
(
course_block_tree
,
all_blocks
[
'blocks'
])
'blocks'
:
self
.
populate_children
(
course_block_tree
,
all_blocks
[
'blocks'
]
,
course_position
)
}
html
=
render_to_string
(
'course_experience/course-outline-fragment.html'
,
context
)
return
Fragment
(
html
)
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