Commit 653df428 by cahrens

Improve code clarity.

parent 9b2a78b1
...@@ -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")
......
...@@ -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>')
) )
......
...@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment