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
acc3a045
Commit
acc3a045
authored
Feb 14, 2017
by
Brian Jacobel
Committed by
Diana Huang
Mar 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Link outline subsections into the course
parent
7bef3c0e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
67 additions
and
40 deletions
+67
-40
common/lib/xmodule/xmodule/js/src/sequence/display.js
+10
-1
common/static/common/templates/sequence-breadcrumbs.underscore
+7
-0
common/test/acceptance/pages/lms/courseware.py
+1
-1
lms/djangoapps/courseware/static_tab.html
+33
-0
lms/djangoapps/courseware/tabs.py
+3
-1
lms/djangoapps/courseware/views/index.py
+5
-1
lms/djangoapps/courseware/views/views.py
+2
-2
lms/static/sass/shared-v2/_course-outline.scss
+5
-4
lms/templates/courseware/course-outline.html
+0
-29
lms/templates/courseware/courseware.html
+1
-1
No files found.
common/lib/xmodule/xmodule/js/src/sequence/display.js
View file @
acc3a045
...
@@ -268,7 +268,16 @@
...
@@ -268,7 +268,16 @@
this
.
updatePageTitle
();
this
.
updatePageTitle
();
sequenceLinks
=
this
.
content_container
.
find
(
'a.seqnav'
);
sequenceLinks
=
this
.
content_container
.
find
(
'a.seqnav'
);
sequenceLinks
.
click
(
this
.
goto
);
sequenceLinks
.
click
(
this
.
goto
);
this
.
path
.
text
(
this
.
el
.
find
(
'.nav-item.active'
).
data
(
'path'
));
edx
.
HtmlUtils
.
setHtml
(
this
.
path
,
edx
.
HtmlUtils
.
template
(
$
(
'#sequence-breadcrumbs-tpl'
).
text
())({
courseId
:
this
.
el
.
parent
().
data
(
'course-id'
),
blockId
:
this
.
id
,
pathText
:
this
.
el
.
find
(
'.nav-item.active'
).
data
(
'path'
)
})
);
this
.
sr_container
.
focus
();
this
.
sr_container
.
focus
();
}
}
};
};
...
...
common/static/common/templates/sequence-breadcrumbs.underscore
0 → 100644
View file @
acc3a045
<a href="<%- '/courses/' + courseId + '/course/#' + blockId %>">
<span class="fa fa-arrow-circle-left" aria-hidden="true" aria-describedby="outline-description"></span>
<span class="sr-only" id="outline-description"><%- gettext('Return to course outline') %></span>
<b><%- gettext('Outline') %></b>
</a>
<span> > </span>
<span class="position"><%- pathText %></span>
common/test/acceptance/pages/lms/courseware.py
View file @
acc3a045
...
@@ -274,7 +274,7 @@ class CoursewarePage(CoursePage):
...
@@ -274,7 +274,7 @@ class CoursewarePage(CoursePage):
@property
@property
def
breadcrumb
(
self
):
def
breadcrumb
(
self
):
""" Return the course tree breadcrumb shown above the sequential bar """
""" Return the course tree breadcrumb shown above the sequential bar """
return
[
part
.
strip
()
for
part
in
self
.
q
(
css
=
'.path'
)
.
text
[
0
]
.
split
(
'>'
)]
return
[
part
.
strip
()
for
part
in
self
.
q
(
css
=
'.path
.position
'
)
.
text
[
0
]
.
split
(
'>'
)]
def
unit_title_visible
(
self
):
def
unit_title_visible
(
self
):
""" Check if unit title is visible """
""" Check if unit title is visible """
...
...
lms/djangoapps/courseware/static_tab.html
0 → 100644
View file @
acc3a045
## mako
<
%
page
expression_filter=
"h"
/>
<
%!
from
openedx
.
core
.
djangolib
.
markup
import
HTML
%
>
<
%
inherit
file=
"/main.html"
/>
<
%
block
name=
"bodyclass"
>
view-in-course view-statictab ${course.css_class or ''}
</
%
block>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'style-course-vendor'
/>
<
%
static:css
group=
'style-course'
/>
${HTML(fragment.head_html())}
</
%
block>
<
%
block
name=
"js_extra"
>
<
%
include
file=
"/mathjax_include.html"
args=
"disable_fast_preview=True"
/>
${HTML(fragment.foot_html())}
</
%
block>
<
%
block
name=
"pagetitle"
>
${tab['name']} | ${course.display_number_with_default}
</
%
block>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page=active_page"
/>
<main
id=
"main"
aria-label=
"Content"
tabindex=
"-1"
>
<section
class=
"container"
>
<div
class=
"static_tab_wrapper"
>
${HTML(fragment.body_html())}
</div>
</section>
</main>
lms/djangoapps/courseware/tabs.py
View file @
acc3a045
...
@@ -10,6 +10,7 @@ from django.utils.translation import ugettext as _, ugettext_noop
...
@@ -10,6 +10,7 @@ from django.utils.translation import ugettext as _, ugettext_noop
from
courseware.access
import
has_access
from
courseware.access
import
has_access
from
courseware.entrance_exams
import
user_must_complete_entrance_exam
from
courseware.entrance_exams
import
user_must_complete_entrance_exam
from
openedx.core.lib.course_tabs
import
CourseTabPluginManager
from
openedx.core.lib.course_tabs
import
CourseTabPluginManager
from
request_cache.middleware
import
RequestCache
from
student.models
import
CourseEnrollment
from
student.models
import
CourseEnrollment
from
xmodule.tabs
import
CourseTab
,
CourseTabList
,
key_checker
,
link_reverse_func
from
xmodule.tabs
import
CourseTab
,
CourseTabList
,
key_checker
,
link_reverse_func
...
@@ -41,7 +42,8 @@ class CoursewareTab(EnrolledTab):
...
@@ -41,7 +42,8 @@ class CoursewareTab(EnrolledTab):
"""
"""
Returns a function that computes the URL for this tab.
Returns a function that computes the URL for this tab.
"""
"""
if
waffle
.
switch_is_active
(
'unified_course_view'
):
request
=
RequestCache
.
get_current_request
()
if
waffle
.
flag_is_active
(
request
,
'unified_course_view'
):
return
link_reverse_func
(
'unified_course_view'
)
return
link_reverse_func
(
'unified_course_view'
)
else
:
else
:
return
link_reverse_func
(
'courseware'
)
return
link_reverse_func
(
'courseware'
)
...
...
lms/djangoapps/courseware/views/index.py
View file @
acc3a045
...
@@ -21,12 +21,14 @@ from edxmako.shortcuts import render_to_response, render_to_string
...
@@ -21,12 +21,14 @@ from edxmako.shortcuts import render_to_response, render_to_string
import
logging
import
logging
import
newrelic.agent
import
newrelic.agent
import
urllib
import
urllib
import
waffle
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.keys
import
CourseKey
from
openedx.core.djangoapps.lang_pref
import
LANGUAGE_KEY
from
openedx.core.djangoapps.lang_pref
import
LANGUAGE_KEY
from
openedx.core.djangoapps.user_api.preferences.api
import
get_user_preference
from
openedx.core.djangoapps.user_api.preferences.api
import
get_user_preference
from
openedx.core.djangoapps.crawlers.models
import
CrawlersConfig
from
openedx.core.djangoapps.crawlers.models
import
CrawlersConfig
from
request_cache.middleware
import
RequestCache
from
shoppingcart.models
import
CourseRegistrationCode
from
shoppingcart.models
import
CourseRegistrationCode
from
student.models
import
CourseEnrollment
from
student.models
import
CourseEnrollment
from
student.views
import
is_course_blocked
from
student.views
import
is_course_blocked
...
@@ -396,6 +398,7 @@ class CoursewareIndex(View):
...
@@ -396,6 +398,7 @@ class CoursewareIndex(View):
Returns and creates the rendering context for the courseware.
Returns and creates the rendering context for the courseware.
Also returns the table of contents for the courseware.
Also returns the table of contents for the courseware.
"""
"""
request
=
RequestCache
.
get_current_request
()
courseware_context
=
{
courseware_context
=
{
'csrf'
:
csrf
(
self
.
request
)[
'csrf_token'
],
'csrf'
:
csrf
(
self
.
request
)[
'csrf_token'
],
'COURSE_TITLE'
:
self
.
course
.
display_name_with_default_escaped
,
'COURSE_TITLE'
:
self
.
course
.
display_name_with_default_escaped
,
...
@@ -411,7 +414,8 @@ class CoursewareIndex(View):
...
@@ -411,7 +414,8 @@ class CoursewareIndex(View):
'language_preference'
:
self
.
_get_language_preference
(),
'language_preference'
:
self
.
_get_language_preference
(),
'disable_optimizely'
:
True
,
'disable_optimizely'
:
True
,
'section_title'
:
None
,
'section_title'
:
None
,
'sequence_title'
:
None
'sequence_title'
:
None
,
'disable_accordion'
:
waffle
.
flag_is_active
(
request
,
'unified_course_view'
)
}
}
table_of_contents
=
toc_for_course
(
table_of_contents
=
toc_for_course
(
self
.
effective_user
,
self
.
effective_user
,
...
...
lms/djangoapps/courseware/views/views.py
View file @
acc3a045
...
@@ -1680,7 +1680,7 @@ class CourseOutlineFragmentView(FragmentView):
...
@@ -1680,7 +1680,7 @@ class CourseOutlineFragmentView(FragmentView):
return
block
return
block
def
render_fragment
(
self
,
request
,
course_id
=
None
):
def
render_fragment
(
self
,
request
,
course_id
=
None
,
**
kwargs
):
"""
"""
Renders the course outline as a fragment.
Renders the course outline as a fragment.
"""
"""
...
@@ -1704,5 +1704,5 @@ class CourseOutlineFragmentView(FragmentView):
...
@@ -1704,5 +1704,5 @@ class CourseOutlineFragmentView(FragmentView):
# Recurse through the block tree, fleshing out each child object
# 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'
])
}
}
html
=
render_to_string
(
'courseware/course
-
outline.html'
,
context
)
html
=
render_to_string
(
'courseware/course
_
outline.html'
,
context
)
return
Fragment
(
html
)
return
Fragment
(
html
)
lms/static/sass/shared-v2/_course-outline.scss
View file @
acc3a045
.course-outline
{
.course-outline
{
color
:
$lms-gray
;
color
:
$lms-gray
;
u
l
{
o
l
{
margin
:
0
$baseline
;
margin
:
0
$baseline
;
list-style
:
none
;
list-style
:
none
;
>
u
l
{
>
o
l
{
@include
margin-left
(
$baseline
/
2
);
@include
margin-left
(
$baseline
/
2
);
}
}
li
.section-name
{
div
.section-name
{
@include
padding
(
$baseline
*
0
.75
,
$baseline
*
0
.75
,
$baseline
*
0
.75
,
$baseline
/
4
);
@include
padding
(
$baseline
*
0
.75
,
$baseline
*
0
.75
,
$baseline
*
0
.75
,
$baseline
/
4
);
background-color
:
$lms-background-color
;
background-color
:
$lms-background-color
;
border-top
:
1px
solid
$lms-border-color
;
border-top
:
1px
solid
$lms-border-color
;
margin-bottom
:
$baseline
*
0
.5
;
}
}
u
l
.outline-item
{
o
l
.outline-item
{
@include
margin-left
(
$baseline
);
@include
margin-left
(
$baseline
);
padding-bottom
:
(
$baseline
/
2
);
padding-bottom
:
(
$baseline
/
2
);
...
...
lms/templates/courseware/course-outline.html
deleted
100644 → 0
View file @
7bef3c0e
## mako
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%
static:require_module_async
module_name=
"js/courseware/course_outline_factory"
class_name=
"CourseOutlineFactory"
>
CourseOutlineFactory('.block-tree');
</
%
static:require
_module_async
>
<section
class=
"course-outline"
id=
"main"
>
<ul
class=
"block-tree"
role=
"tree"
>
% for section in blocks.get('children') or []:
<li
class=
"section-name outline-item focusable"
role=
"treeitem"
tabindex=
"0"
aria-expanded=
"true"
>
<span
class=
"icon fa fa-chevron-down"
aria-hidden=
"true"
></span>
${ section['display_name'] }
</li>
<ul
class=
"outline-item focusable"
role=
"group"
tabindex=
"0"
>
% for subsection in section.get('children') or []:
<li
class=
"outline-item focusable"
role=
"treeitem"
tabindex=
"0"
aria-expanded=
"true"
>
<a
href=
"#"
>
${ subsection['display_name'] }
</a>
</li>
% endfor
</ul>
% endfor
</ul>
</section>
lms/templates/courseware/courseware.html
View file @
acc3a045
...
@@ -27,7 +27,7 @@ from openedx.core.djangolib.js_utils import js_escaped_string
...
@@ -27,7 +27,7 @@ from openedx.core.djangolib.js_utils import js_escaped_string
<
%
block
name=
"header_extras"
>
<
%
block
name=
"header_extras"
>
% for template_name in ["image-modal"]:
% for template_name in ["image-modal"
, "sequence-breadcrumbs"
]:
<script
type=
"text/template"
id=
"${template_name}-tpl"
>
<script
type=
"text/template"
id=
"${template_name}-tpl"
>
<%
static
:
include
path
=
"common/templates/${template_name}.underscore"
/>
<%
static
:
include
path
=
"common/templates/${template_name}.underscore"
/>
</script>
</script>
...
...
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