From 71e74949e945a1524fe04c9a089d54f84f5611dd Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Thu, 5 Apr 2018 16:44:21 -0400 Subject: [PATCH] Change in-context waffle switch to a flag Also update studio-frontend to version 1.7.1 --- cms/djangoapps/contentstore/config/waffle.py | 20 +++++++++++++++++--- cms/templates/container.html | 8 ++++---- package-lock.json | 8 ++++---- package.json | 2 +- 4 files changed, 26 insertions(+), 12 deletions(-) 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):
<%static:studiofrontend entry="editImageModal"> { diff --git a/package-lock.json b/package-lock.json index b0ac919b37..6cc5f56492 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,9 +62,9 @@ } }, "@edx/studio-frontend": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@edx/studio-frontend/-/studio-frontend-1.7.0.tgz", - "integrity": "sha512-h4jas5y/tXb8PUqMVpDlauRgt2qQJ2A4GDCfBu2V60LDvblJZP4Cn2Wd4PVgWqO8MrqCUUZsE0LiqJBMgYovUg==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@edx/studio-frontend/-/studio-frontend-1.7.1.tgz", + "integrity": "sha512-BTpTMD55HgSOvVojMcZs6xa4gGjAx2Zw5jPykUkP1yU/HwORCSU088jGy4Fnluxf155Vk3PF2ggm1sBLX15ztQ==", "requires": { "@edx/edx-bootstrap": "0.4.3", "@edx/paragon": "2.5.3", @@ -7504,7 +7504,7 @@ }, "onetime": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, diff --git a/package.json b/package.json index 0c7b9b475c..d91c0244f3 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "dependencies": { "@edx/edx-bootstrap": "0.4.3", "@edx/paragon": "2.5.6", - "@edx/studio-frontend": "1.7.0", + "@edx/studio-frontend": "1.7.1", "babel-core": "6.26.0", "babel-loader": "6.4.1", "babel-plugin-transform-class-properties": "6.24.1",