fix: infinite load for library content block view (#34412)
* fix: hide view button when block is not configured * fix: remove script for load timer if no children or library * fix: remove print message * fix: NoneType error is tests
This commit is contained in:
@@ -20,6 +20,7 @@ show_inline = xblock.has_children and not xblock_url
|
||||
section_class = "level-nesting" if show_inline else "level-element"
|
||||
label = determine_label(xblock.display_name_with_default, xblock.scope_ids.block_type)
|
||||
messages = xblock.validate().to_json()
|
||||
has_not_configured_message = messages.get('summary',{}).get('type', None) == 'not-configured'
|
||||
block_is_unit = is_unit(xblock)
|
||||
%>
|
||||
|
||||
@@ -190,7 +191,7 @@ block_is_unit = is_unit(xblock)
|
||||
</div>
|
||||
% if not is_root:
|
||||
<div class="wrapper-xblock-message xblock-validation-messages" data-locator="${xblock.location}"/>
|
||||
% if xblock_url:
|
||||
% if xblock_url and not has_not_configured_message:
|
||||
<div class="xblock-header-secondary">
|
||||
<div class="meta-info">${_('This block contains multiple components.')}</div>
|
||||
<ul class="actions-list">
|
||||
|
||||
@@ -451,7 +451,12 @@ class LibraryContentBlock(
|
||||
context['is_loading'] = is_updating
|
||||
|
||||
# The following JS is used to make the "Update now" button work on the unit page and the container view:
|
||||
fragment.add_javascript_url(self.runtime.local_resource_url(self, 'public/js/library_content_edit.js'))
|
||||
if root_xblock and 'library' in root_xblock.category:
|
||||
if root_xblock.source_library_id and len(root_xblock.children) > 0:
|
||||
fragment.add_javascript_url(self.runtime.local_resource_url(self, 'public/js/library_content_edit.js'))
|
||||
else:
|
||||
fragment.add_javascript_url(self.runtime.local_resource_url(self, 'public/js/library_content_edit.js'))
|
||||
|
||||
fragment.initialize_js('LibraryContentAuthorView')
|
||||
return fragment
|
||||
|
||||
|
||||
Reference in New Issue
Block a user