Skip to content
Merged
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
11 changes: 11 additions & 0 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,17 @@ def get_taxonomy_list_url() -> str | None:
return f'{mfe_base_url}/taxonomies'


def get_libraries_list_url() -> str | None:
"""
Gets course authoring microfrontend URL for libraries list view.
"""
mfe_base_url = settings.COURSE_AUTHORING_MICROFRONTEND_URL
if not mfe_base_url:
return None

return f'{mfe_base_url}/libraries'


def get_taxonomy_tags_widget_url(course_locator=None) -> str | None:
"""
Gets course authoring microfrontend URL for taxonomy tags drawer widget view.
Expand Down
2 changes: 1 addition & 1 deletion cms/static/sass/elements/_modal-window.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
padding: 5%;
}

.title {
.title:not(.deprecated-title) {
@extend %t-title5;
@extend %t-demi-strong;

Expand Down
30 changes: 29 additions & 1 deletion cms/templates/library-block-author-preview-header.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
<%page expression_filter="h"/>
<%! from django.utils.translation import ngettext %>
<%!
from django.utils.translation import ngettext, gettext as _
from cms.djangoapps.contentstore.utils import get_libraries_list_url

libraries_list_url = get_libraries_list_url()
%>
<div class="wrapper-xblock-message">
<div class="wrapper wrapper-alert wrapper-alert-warning is-shown" role="alert">
<div class="alert announcement">
<span class="feedback-symbol fa fa-warning" aria-hidden="true"></span>
<span class="sr">${_("Warning")}</span>
<div class="copy">
<h2 class="title title-3 warning-heading-text">
${_("You are creating content in a deprecated format.")}
</h2>
<p>
${_(
"Legacy libraries will be unsupported in Willow. Any content you create in a"
" legacy library will soon need to be migrated. Consider using the "
)}
% if libraries_list_url:
<a href="${get_libraries_list_url()}" target="_blank">${_("Libraries feature")}</a>
% else:
${_("Libraries feature")}
% endif
${_(" instead.")}
</p>
</div>
</div>
</div>
<div class="xblock-message information">
<p>
<span class="message-text">
Expand Down
26 changes: 25 additions & 1 deletion cms/templates/library.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</%def>
<%!
from cms.djangoapps.contentstore.helpers import xblock_studio_url, xblock_type_display_name
from cms.djangoapps.contentstore.utils import get_libraries_list_url
from django.utils.translation import gettext as _
from openedx.core.djangolib.js_utils import dump_js_escaped_json
from openedx.core.djangolib.markup import HTML, Text
Expand Down Expand Up @@ -41,7 +42,7 @@
</%block>

<%block name="content">

<% libraries_list_url = get_libraries_list_url() %>

<div class="wrapper-mast wrapper">
<header class="mast has-actions has-navigation has-subtitle">
Expand Down Expand Up @@ -77,6 +78,29 @@ <h3 class="sr">${_("Page Actions")}</h3>
<div class="content-area">

<div class="content-primary">
<div class="wrapper wrapper-alert wrapper-alert-warning is-shown" role="alert">
<div class="alert announcement">
<span class="feedback-symbol fa fa-warning" aria-hidden="true"></span>
<span class="sr">${_("Warning")}</span>
<div class="copy">
<h2 class="title title-3 warning-heading-text">
${_("You are creating content in a deprecated format.")}
</h2>
<p>
${_(
"Legacy libraries will be unsupported in Willow. Any content you create in a"
" legacy library will soon need to be migrated. Consider using the "
)}
% if libraries_list_url:
<a href="${get_libraries_list_url() or "#"}" targht="_blank">${_("Libraries feature")}</a>
% else:
${_("Libraries feature")}
% endif
${_(" instead.")}
</p>
</div>
</div>
</div>
<div class="container-message wrapper-message"></div>
<div class="wrapper-xblock level-page is-hidden studio-xblock-wrapper" data-locator="${context_library.location}" data-course-key="${context_library.location.library_key}">
</div>
Expand Down
28 changes: 28 additions & 0 deletions cms/templates/widgets/metadata-edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,32 @@
<%include file="source-edit.html" />
% endif

## It is used to display a warning if a block (i.e. a LibraryContentBlock) uses the deprecated
## legacy libraries feature.
% if show_deprecated_warning:
<div class="wrapper wrapper-alert wrapper-alert-warning is-shown" role="alert">
<div class="alert announcement">
<span class="feedback-symbol fa fa-warning" aria-hidden="true"></span>
<span class="sr">${_("Warning")}</span>
<div class="copy">
<h2 class="title deprecated-title title-3 warning-heading-text">
${_("You are creating content in a deprecated format.")}
</h2>
<p>
${_(
"Legacy libraries will be unsupported in Willow. Any content you create in a"
" legacy library will soon need to be migrated. Consider using the "
)}
% if libraries_list_url:
<a href="${library_url}" target="_blank">${_("Libraries feature")}</a>
% else:
${_("Libraries feature")}
% endif
${_(" instead.")}
</p>
</div>
</div>
</div>
% endif

<div class="wrapper-comp-settings metadata_edit" id="settings-tab" data-metadata='${json.dumps(metadata_field_copy, cls=EdxJSONEncoder) | h}'></div>
14 changes: 14 additions & 0 deletions xmodule/library_content_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ def is_ready_to_migrate_to_v2(self) -> bool:
"""
return self.is_source_lib_migrated_to_v2 and not self.is_migrated_to_v2

def get_context(self):
"""
Extend context adding `show_deprecated_warning` flag
"""
from cms.djangoapps.contentstore.utils import get_libraries_list_url

library_url = get_libraries_list_url()

context = super().get_context()
context["show_deprecated_warning"] = True
context["library_url"] = library_url

return context

def author_view(self, context):
"""
Renders the Studio views.
Expand Down
Loading