Merge pull request #17362 from caesar2164/allow-about-sidebar-content-from-instructor

Add custom HTML to Course About page sidebar
This commit is contained in:
Zia Fazal
2018-06-04 09:41:52 +05:00
committed by GitHub
13 changed files with 125 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ ABOUT_ATTRIBUTES = [
'entrance_exam_enabled',
'entrance_exam_id',
'entrance_exam_minimum_score_pct',
'about_sidebar_html',
]
@@ -52,6 +53,7 @@ class CourseDetails(object):
self.description = ""
self.short_description = ""
self.overview = "" # html to render as the overview
self.about_sidebar_html = ""
self.intro_video = None # a video pointer
self.effort = None # hours/week
self.license = "all-rights-reserved" # default course license is all rights reserved

View File

@@ -72,6 +72,11 @@ class CourseDetailsTestCase(ModuleStoreTestCase):
CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).intro_video,
jsondetails.intro_video, "After set intro_video"
)
jsondetails.about_sidebar_html = "About Sidebar HTML"
self.assertEqual(
CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).about_sidebar_html,
jsondetails.about_sidebar_html, "After set about_sidebar_html"
)
jsondetails.effort = "effort"
self.assertEqual(
CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).effort,

View File

@@ -0,0 +1,17 @@
"""
Miscellaneous waffle switches that both LMS and Studio need to access
"""
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
# Namespace
WAFFLE_NAMESPACE = u'course_experience'
# Switches
ENABLE_COURSE_ABOUT_SIDEBAR_HTML = u'enable_about_sidebar_html'
def waffle():
"""
Returns the namespaced, cached, audited shared Waffle Switch class.
"""
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Course Experience: ')