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
577dea6a
Commit
577dea6a
authored
Jan 17, 2017
by
Ari Rizzitano
Committed by
GitHub
Jan 17, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14239 from edx/arizzitano/courseware-sequence-title
generate sequence-specific titles server-side
parents
d497e194
54a48a32
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
10 deletions
+22
-10
common/lib/xmodule/xmodule/js/src/sequence/display.js
+8
-3
lms/djangoapps/courseware/tests/test_views.py
+1
-0
lms/djangoapps/courseware/views/index.py
+7
-0
lms/templates/courseware/courseware.html
+5
-7
openedx/core/djangoapps/site_configuration/helpers.py
+1
-0
No files found.
common/lib/xmodule/xmodule/js/src/sequence/display.js
View file @
577dea6a
...
...
@@ -57,8 +57,8 @@
this
.
ajaxUrl
=
this
.
el
.
data
(
'ajax-url'
);
this
.
nextUrl
=
this
.
el
.
data
(
'next-url'
);
this
.
prevUrl
=
this
.
el
.
data
(
'prev-url'
);
this
.
base_page_title
=
' | '
+
document
.
title
;
this
.
keydownHandler
(
$
(
element
).
find
(
'#sequence-list .tab'
));
this
.
base_page_title
=
(
$
(
'title'
).
data
(
'base-title'
)
||
''
).
trim
();
this
.
bind
();
this
.
render
(
parseInt
(
this
.
el
.
data
(
'position'
),
10
));
}
...
...
@@ -136,10 +136,15 @@
Sequence
.
prototype
.
updatePageTitle
=
function
()
{
// update the page title to include the current section
var
positionLink
=
this
.
link_for
(
this
.
position
);
var
currentSectionTitle
,
positionLink
=
this
.
link_for
(
this
.
position
);
if
(
positionLink
&&
positionLink
.
data
(
'page-title'
))
{
document
.
title
=
positionLink
.
data
(
'page-title'
)
+
this
.
base_page_title
;
currentSectionTitle
=
positionLink
.
data
(
'page-title'
)
+
' | '
+
this
.
base_page_title
;
if
(
currentSectionTitle
!==
document
.
title
)
{
document
.
title
=
currentSectionTitle
;
}
}
};
...
...
lms/djangoapps/courseware/tests/test_views.py
View file @
577dea6a
...
...
@@ -1824,6 +1824,7 @@ class ViewCheckerBlock(XBlock):
"""
has_children
=
True
state
=
String
(
scope
=
Scope
.
user_state
)
position
=
0
def
student_view
(
self
,
context
):
# pylint: disable=unused-argument
"""
...
...
lms/djangoapps/courseware/views/index.py
View file @
577dea6a
...
...
@@ -388,6 +388,8 @@ class CoursewareIndex(View):
'bookmarks_api_url'
:
reverse
(
'bookmarks'
),
'language_preference'
:
self
.
_get_language_preference
(),
'disable_optimizely'
:
True
,
'section_title'
:
None
,
'sequence_title'
:
None
}
table_of_contents
=
toc_for_course
(
self
.
effective_user
,
...
...
@@ -437,6 +439,11 @@ class CoursewareIndex(View):
table_of_contents
[
'next_of_active_section'
],
)
courseware_context
[
'fragment'
]
=
self
.
section
.
render
(
STUDENT_VIEW
,
section_context
)
if
self
.
section
.
position
and
self
.
section
.
has_children
:
display_items
=
self
.
section
.
get_display_items
()
if
display_items
:
courseware_context
[
'sequence_title'
]
=
display_items
[
self
.
section
.
position
-
1
]
\
.
display_name_with_default
return
courseware_context
...
...
lms/templates/courseware/courseware.html
View file @
577dea6a
...
...
@@ -19,13 +19,11 @@ from openedx.core.djangolib.js_utils import js_escaped_string
<
%
block
name=
"bodyclass"
>
view-in-course view-courseware courseware ${course.css_class or ''}
</
%
block>
<
%
block
name=
"title"
><title>
% if section_title:
${static.get_page_title_breadcrumbs(section_title, course_name())}
% else:
${static.get_page_title_breadcrumbs(course_name())}
%endif
</title></
%
block>
<
%
block
name=
"title"
>
<title
data-base-title=
"${static.get_page_title_breadcrumbs(section_title, course_name())}"
>
${static.get_page_title_breadcrumbs(sequence_title, section_title, course_name())}
</title>
</
%
block>
<
%
block
name=
"header_extras"
>
...
...
openedx/core/djangoapps/site_configuration/helpers.py
View file @
577dea6a
...
...
@@ -211,6 +211,7 @@ def page_title_breadcrumbs(*crumbs, **kwargs):
"""
platform_name
=
get_value
(
'platform_name'
,
settings
.
PLATFORM_NAME
)
separator
=
kwargs
.
get
(
"separator"
,
" | "
)
crumbs
=
[
c
for
c
in
crumbs
if
c
is
not
None
]
if
crumbs
:
return
u'{}{}{}'
.
format
(
separator
.
join
(
crumbs
),
separator
,
platform_name
)
else
:
...
...
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