Revert "Feat change default title for text xblock to be 'text'"

This commit is contained in:
connorhaugh
2022-06-01 10:52:09 -04:00
committed by GitHub
parent 02e29168b2
commit 2e13033fbe
4 changed files with 3 additions and 48 deletions

View File

@@ -736,34 +736,3 @@ class ValidateCourseOlxTests(CourseTestCase):
ignore=ignore,
allowed_xblocks=allowed_xblocks
)
class DetermineLabelTestCase(TestCase):
"""Tests for xblock Title quirks"""
def validate_html_replaced_with_text(self):
"""
Tests that display names for "html" xblocks are repleaced with "Text" when the display name is otherwise unset.
"""
display_name = None
block_type = "html"
result = utils.determine_label(display_name, block_type)
self.assertEqual(result, display_name)
def validate_set_titles_not_replaced(self):
"""
Tests that display names for "html" xblocks are not repleaced with "Text" when the display name is set.
"""
display_name = "Something"
block_type = "html"
result = utils.determine_label(display_name, block_type)
self.assertEqual(result, display_name)
def validate_non_html_blocks_titles_not_replaced(self):
"""
Tests that display names for non-"html" xblocks are not repleaced with "Text" when the display name is set.
"""
display_name = None
block_type = "something else"
result = utils.determine_label(display_name, block_type)
self.assertEqual(result, display_name)

View File

@@ -703,17 +703,6 @@ def get_sibling_urls(subsection, unit_location): # pylint: disable=too-many-s
return prev_url, next_url
def determine_label(display_name, block_type):
"""
Returns the name of the xblock to display in studio.
Please see TNL-9838.
"""
label = display_name
if block_type == 'html':
label = _("Text")
return label
@contextmanager
def translation_language(language):
"""Context manager to override the translation language for the scope

View File

@@ -427,16 +427,13 @@ def xblock_view_handler(request, usage_key_string, view_name):
# Note that the container view recursively adds headers into the preview fragment,
# so only the "Pages" view requires that this extra wrapper be included.
display_label = xblock.display_name or xblock.scope_ids.block_type
if not xblock.display_name and xblock.scope_ids.block_type == 'html':
display_label = _("Text")
if is_pages_view:
fragment.content = render_to_string('component.html', {
'xblock_context': context,
'xblock': xblock,
'locator': usage_key,
'preview': fragment.content,
'label': display_label,
'label': xblock.display_name or xblock.scope_ids.block_type,
})
else:
raise Http404

View File

@@ -2,7 +2,7 @@
<%!
from django.utils.translation import gettext as _
from cms.djangoapps.contentstore.views.helpers import xblock_studio_url
from cms.djangoapps.contentstore.utils import is_visible_to_specific_partition_groups, get_editor_page_base_url, determine_label
from cms.djangoapps.contentstore.utils import is_visible_to_specific_partition_groups, get_editor_page_base_url
from lms.lib.utils import is_unit
from openedx.core.djangolib.js_utils import (
dump_js_escaped_json, js_escaped_string
@@ -17,7 +17,7 @@ xblock_url = xblock_studio_url(xblock)
show_inline = xblock.has_children and not xblock_url
section_class = "level-nesting" if show_inline else "level-element"
collapsible_class = "is-collapsible" if xblock.has_children else ""
label = determine_label(xblock.display_name_with_default, xblock.scope_ids.block_type)
label = xblock.display_name_with_default or xblock.scope_ids.block_type
messages = xblock.validate().to_json()
block_is_unit = is_unit(xblock)
%>