diff --git a/cms/djangoapps/contentstore/config/waffle.py b/cms/djangoapps/contentstore/config/waffle.py index 8c48795b3c..90f71298f4 100644 --- a/cms/djangoapps/contentstore/config/waffle.py +++ b/cms/djangoapps/contentstore/config/waffle.py @@ -2,7 +2,7 @@ This module contains various configuration settings via waffle switches for the contentstore app. """ -from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace +from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNamespace, WaffleSwitchNamespace # Namespace WAFFLE_NAMESPACE = u'studio' @@ -10,11 +10,25 @@ WAFFLE_NAMESPACE = u'studio' # Switches ENABLE_ACCESSIBILITY_POLICY_PAGE = u'enable_policy_page' ENABLE_ASSETS_SEARCH = u'enable_assets_search' -ENABLE_IN_CONTEXT_IMAGE_SELECTION = u'enable_in_context_image_selection' def waffle(): """ - Returns the namespaced, cached, audited Waffle class for Studio pages. + Returns the namespaced, cached, audited Waffle Switch class for Studio pages. """ return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Studio: ') + + +def waffle_flags(): + """ + Returns the namespaced, cached, audited Waffle Flag class for Studio pages. + """ + return WaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Studio: ') + + +# Flags +ENABLE_IN_CONTEXT_IMAGE_SELECTION = CourseWaffleFlag( + waffle_namespace=waffle_flags(), + flag_name=u'enable_in_context_image_selection', + flag_undefined_default=False +) diff --git a/cms/templates/container.html b/cms/templates/container.html index 37265f16b8..885e0eb2ac 100644 --- a/cms/templates/container.html +++ b/cms/templates/container.html @@ -11,7 +11,7 @@ else: <%! from django.utils.translation import ugettext as _ -from cms.djangoapps.contentstore.config.waffle import waffle, ENABLE_IN_CONTEXT_IMAGE_SELECTION +from cms.djangoapps.contentstore.config.waffle import ENABLE_IN_CONTEXT_IMAGE_SELECTION from contentstore.views.helpers import xblock_studio_url, xblock_type_display_name from openedx.core.djangolib.js_utils import ( dump_js_escaped_json, js_escaped_string @@ -34,7 +34,7 @@ from openedx.core.djangolib.markup import HTML, Text <%static:include path="common/templates/image-modal.underscore" /> -% if waffle().is_enabled(ENABLE_IN_CONTEXT_IMAGE_SELECTION): +% if ENABLE_IN_CONTEXT_IMAGE_SELECTION.is_enabled(xblock_locator.course_key): % endif @@ -57,7 +57,7 @@ from openedx.core.djangolib.markup import HTML, Text <%block name="content"> -% if waffle().is_enabled(ENABLE_IN_CONTEXT_IMAGE_SELECTION): +% if ENABLE_IN_CONTEXT_IMAGE_SELECTION.is_enabled(xblock_locator.course_key): @@ -170,7 +170,7 @@ from openedx.core.djangolib.markup import HTML, Text % endif - % if waffle().is_enabled(ENABLE_IN_CONTEXT_IMAGE_SELECTION): + % if ENABLE_IN_CONTEXT_IMAGE_SELECTION.is_enabled(xblock_locator.course_key):