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
653df428
Commit
653df428
authored
Mar 05, 2014
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve code clarity.
parent
9b2a78b1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
cms/djangoapps/contentstore/views/component.py
+4
-5
cms/djangoapps/contentstore/views/tests/test_item.py
+2
-0
cms/templates/container.html
+5
-5
No files found.
cms/djangoapps/contentstore/views/component.py
View file @
653df428
...
@@ -23,7 +23,6 @@ from xblock.exceptions import NoSuchHandlerError
...
@@ -23,7 +23,6 @@ from xblock.exceptions import NoSuchHandlerError
from
xblock.fields
import
Scope
from
xblock.fields
import
Scope
from
xblock.plugin
import
PluginMissingError
from
xblock.plugin
import
PluginMissingError
from
xblock.runtime
import
Mixologist
from
xblock.runtime
import
Mixologist
from
xmodule.x_module
import
prefer_xmodules
from
lms.lib.xblock.runtime
import
unquote_slashes
from
lms.lib.xblock.runtime
import
unquote_slashes
...
@@ -311,19 +310,19 @@ def container_handler(request, tag=None, package_id=None, branch=None, version_g
...
@@ -311,19 +310,19 @@ def container_handler(request, tag=None, package_id=None, branch=None, version_g
except
ItemNotFoundError
:
except
ItemNotFoundError
:
return
HttpResponseBadRequest
()
return
HttpResponseBadRequest
()
parent
_xblocks
=
[]
ancestor
_xblocks
=
[]
parent
=
get_parent_xblock
(
xblock
)
parent
=
get_parent_xblock
(
xblock
)
while
parent
and
parent
.
category
!=
'sequential'
:
while
parent
and
parent
.
category
!=
'sequential'
:
parent
_xblocks
.
append
(
parent
)
ancestor
_xblocks
.
append
(
parent
)
parent
=
get_parent_xblock
(
parent
)
parent
=
get_parent_xblock
(
parent
)
parent
_xblocks
.
reverse
()
ancestor
_xblocks
.
reverse
()
return
render_to_response
(
'container.html'
,
{
return
render_to_response
(
'container.html'
,
{
'context_course'
:
course
,
'context_course'
:
course
,
'xblock'
:
xblock
,
'xblock'
:
xblock
,
'xblock_locator'
:
locator
,
'xblock_locator'
:
locator
,
'
parent_xblocks'
:
parent
_xblocks
,
'
ancestor_xblocks'
:
ancestor
_xblocks
,
})
})
else
:
else
:
return
HttpResponseBadRequest
(
"Only supports html requests"
)
return
HttpResponseBadRequest
(
"Only supports html requests"
)
...
...
cms/djangoapps/contentstore/views/tests/test_item.py
View file @
653df428
...
@@ -151,6 +151,8 @@ class GetItem(ItemTest):
...
@@ -151,6 +151,8 @@ class GetItem(ItemTest):
self
.
assertIn
(
'wrapper-xblock'
,
html
)
self
.
assertIn
(
'wrapper-xblock'
,
html
)
self
.
assertRegexpMatches
(
self
.
assertRegexpMatches
(
html
,
html
,
# The instance of the wrapper class will have an auto-generated ID (wrapperxxx). Allow anything
# for the 3 characters after wrapper.
(
r'"/container/MITx.999.Robot_Super_Course/branch/published/block/wrapper.{3}" class="action-button">\s*'
(
r'"/container/MITx.999.Robot_Super_Course/branch/published/block/wrapper.{3}" class="action-button">\s*'
'<span class="action-button-text">View</span>'
)
'<span class="action-button-text">View</span>'
)
)
)
...
...
cms/templates/container.html
View file @
653df428
...
@@ -47,13 +47,13 @@ xblock_info = {
...
@@ -47,13 +47,13 @@ xblock_info = {
<header
class=
"mast has-actions has-navigation"
>
<header
class=
"mast has-actions has-navigation"
>
<h1
class=
"page-header"
>
<h1
class=
"page-header"
>
<small
class=
"navigation navigation-parents"
>
<small
class=
"navigation navigation-parents"
>
% for
parent in parent
_xblocks:
% for
ancestor in ancestor
_xblocks:
<
%
<
%
parent_url =
xblock_studio_url(parent
,
context_course
)
ancestor_url =
xblock_studio_url(ancestor
,
context_course
)
%
>
%
>
% if
parent
_url:
% if
ancestor
_url:
<a
href=
"${
parent
_url}"
<a
href=
"${
ancestor
_url}"
class=
"navigation-link navigation-parent"
>
${
parent
.display_name_with_default | h}
</a>
class=
"navigation-link navigation-parent"
>
${
ancestor
.display_name_with_default | h}
</a>
% endif
% endif
% endfor
% endfor
<a
href=
"#"
class=
"navigation-link navigation-current"
>
${xblock.display_name_with_default | h}
</a>
<a
href=
"#"
class=
"navigation-link navigation-current"
>
${xblock.display_name_with_default | h}
</a>
...
...
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