Add audit access expiration message to courseware_api
to display the banner in the Learner MFE.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
body.view-in-mfe {
|
||||
.course-expiration-message {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.course-expiration-message {
|
||||
background-color: #D8EDF8;
|
||||
color: #393f43;
|
||||
|
||||
@@ -121,6 +121,7 @@ ${HTML(fragment.foot_html())}
|
||||
// it will report the height of its contents to the parent window when the
|
||||
// document loads, window resizes, or DOM mutates.
|
||||
if (window !== window.parent) {
|
||||
document.body.className += ' view-in-mfe';
|
||||
var lastHeight = window.offsetHeight;
|
||||
var lastWidth = window.offsetWidth;
|
||||
var contentElement = document.getElementById('content');
|
||||
|
||||
@@ -69,6 +69,7 @@ class CourseInfoSerializer(serializers.Serializer): # pylint: disable=abstract-
|
||||
Compare this with CourseDetailSerializer.
|
||||
"""
|
||||
|
||||
course_expired_message = serializers.CharField()
|
||||
effort = serializers.CharField()
|
||||
end = serializers.DateTimeField()
|
||||
enrollment_start = serializers.DateTimeField()
|
||||
|
||||
@@ -16,6 +16,7 @@ from lms.djangoapps.courseware.module_render import get_module_by_usage_id
|
||||
from student.models import CourseEnrollment
|
||||
|
||||
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin
|
||||
from openedx.features.course_duration_limits.access import generate_course_expired_message
|
||||
from xmodule.course_module import COURSE_VISIBILITY_PUBLIC
|
||||
|
||||
from .serializers import CourseInfoSerializer
|
||||
@@ -129,6 +130,8 @@ class CoursewareInformation(RetrieveAPIView):
|
||||
overview.user_has_access = overview.can_load_courseware
|
||||
overview.user_has_staff_access = overview.is_staff
|
||||
|
||||
# TODO: TNL-7185 Legacy: Refactor to return the expiration date and format the message in the MFE
|
||||
overview.course_expired_message = generate_course_expired_message(self.request.user, overview)
|
||||
return overview
|
||||
|
||||
def get_serializer_context(self):
|
||||
|
||||
Reference in New Issue
Block a user