Skip to content
Snippets Groups Projects
Commit 0fa60998 authored by stvn's avatar stvn
Browse files

Get upgrade offer banner HTML in courseware API

for use in the Learning MFE.
parent 5233fd3b
No related branches found
No related tags found
No related merge requests found
......@@ -25,3 +25,7 @@
#seq_content .first-purchase-offer-banner {
max-width: $text-width-readability-max;
}
body.view-in-mfe .first-purchase-offer-banner {
display: none;
}
......@@ -79,6 +79,7 @@ class CourseInfoSerializer(serializers.Serializer): # pylint: disable=abstract-
media = _CourseApiMediaCollectionSerializer(source='*')
name = serializers.CharField(source='display_name_with_default_escaped')
number = serializers.CharField(source='display_number_with_default')
offer_html = serializers.CharField()
org = serializers.CharField(source='display_org_with_default')
short_description = serializers.CharField()
start = serializers.DateTimeField()
......
......@@ -18,6 +18,7 @@ from student.models import CourseEnrollment
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
from openedx.features.course_duration_limits.access import generate_course_expired_message
from openedx.features.discounts.utils import generate_offer_html
from xmodule.course_module import COURSE_VISIBILITY_PUBLIC
from .serializers import CourseInfoSerializer
......@@ -117,6 +118,8 @@ class CoursewareInformation(RetrieveAPIView):
# 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)
# TODO: TNL-7185 Legacy: Refactor to return the offer data and format the message in the MFE
overview.offer_html = generate_offer_html(self.request.user, overview)
course_key = CourseKey.from_string(self.kwargs['course_key_string'])
overview.content_type_gating_enabled = ContentTypeGatingConfig.enabled_for_enrollment(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment