Improve code clarity.
This commit is contained in:
@@ -23,7 +23,6 @@ from xblock.exceptions import NoSuchHandlerError
|
||||
from xblock.fields import Scope
|
||||
from xblock.plugin import PluginMissingError
|
||||
from xblock.runtime import Mixologist
|
||||
from xmodule.x_module import prefer_xmodules
|
||||
|
||||
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
|
||||
except ItemNotFoundError:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
parent_xblocks = []
|
||||
ancestor_xblocks = []
|
||||
parent = get_parent_xblock(xblock)
|
||||
while parent and parent.category != 'sequential':
|
||||
parent_xblocks.append(parent)
|
||||
ancestor_xblocks.append(parent)
|
||||
parent = get_parent_xblock(parent)
|
||||
|
||||
parent_xblocks.reverse()
|
||||
ancestor_xblocks.reverse()
|
||||
|
||||
return render_to_response('container.html', {
|
||||
'context_course': course,
|
||||
'xblock': xblock,
|
||||
'xblock_locator': locator,
|
||||
'parent_xblocks': parent_xblocks,
|
||||
'ancestor_xblocks': ancestor_xblocks,
|
||||
})
|
||||
else:
|
||||
return HttpResponseBadRequest("Only supports html requests")
|
||||
|
||||
@@ -151,6 +151,8 @@ class GetItem(ItemTest):
|
||||
self.assertIn('wrapper-xblock', html)
|
||||
self.assertRegexpMatches(
|
||||
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*'
|
||||
'<span class="action-button-text">View</span>')
|
||||
)
|
||||
|
||||
@@ -47,13 +47,13 @@ xblock_info = {
|
||||
<header class="mast has-actions has-navigation">
|
||||
<h1 class="page-header">
|
||||
<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:
|
||||
<a href="${parent_url}"
|
||||
class="navigation-link navigation-parent">${parent.display_name_with_default | h}</a>
|
||||
% if ancestor_url:
|
||||
<a href="${ancestor_url}"
|
||||
class="navigation-link navigation-parent">${ancestor.display_name_with_default | h}</a>
|
||||
% endif
|
||||
% endfor
|
||||
<a href="#" class="navigation-link navigation-current">${xblock.display_name_with_default | h}</a>
|
||||
|
||||
Reference in New Issue
Block a user