Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions xmodule/conditional_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ def student_view(self, _context):
return fragment

def get_html(self):
required_html_ids = [block.location.html_id() for block in self.get_required_blocks]
required_html_ids = [block.usage_key.html_id() for block in self.get_required_blocks]
return self.runtime.service(self, 'mako').render_lms_template('conditional_ajax.html', {
'element_id': self.location.html_id(),
'element_id': self.usage_key.html_id(),
'ajax_url': self.ajax_url,
'depends': ';'.join(required_html_ids)
})
Expand Down
4 changes: 3 additions & 1 deletion xmodule/tests/test_conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def create(system, source_is_error_block=False, source_visible_to_staff_only=Fal
else:
source_block = Mock(name='source_block')
source_block.location = source_location
source_block.usage_key = source_location

source_block.visible_to_staff_only = source_visible_to_staff_only
source_block.runtime = system
Expand All @@ -97,6 +98,7 @@ def create(system, source_is_error_block=False, source_visible_to_staff_only=Fal
child_block.runtime = system
child_block.render = lambda view, context=None: system.render(child_block, view, context)
child_block.location = source_location.replace(category='html', name='child')
child_block.usage_key = child_block.location

def visible_to_nonstaff_users(desc):
"""
Expand All @@ -121,7 +123,7 @@ def load_item(usage_id, for_parent=None): # pylint: disable=unused-argument
'conditional_attr': 'attempted',
'conditional_value': 'true',
'xml_attributes': {'attempted': 'true'},
'children': [child_block.location],
'children': [child_block.usage_key],
})

cond_block = ConditionalBlock(
Expand Down
Loading