Merge pull request #17889 from edx/thallada/switch-to-flag

Change in-context waffle switch to a flag
This commit is contained in:
Tyler Hallada
2018-04-06 10:53:33 -04:00
committed by GitHub
4 changed files with 26 additions and 12 deletions

View File

@@ -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
)

View File

@@ -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" />
</script>
<link rel="stylesheet" type="text/css" href="${static.url('js/vendor/timepicker/jquery.timepicker.css')}" />
% if waffle().is_enabled(ENABLE_IN_CONTEXT_IMAGE_SELECTION):
% if ENABLE_IN_CONTEXT_IMAGE_SELECTION.is_enabled(xblock_locator.course_key):
<link rel="stylesheet" type="text/css" href="${static.url('common/css/vendor/common.min.css')}" />
<link rel="stylesheet" type="text/css" href="${static.url('common/css/vendor/editImageModal.min.css')}" />
% 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):
<script type="text/javascript">
window.STUDIO_FRONTEND_IN_CONTEXT_IMAGE_SELECTION = true;
</script>
@@ -170,7 +170,7 @@ from openedx.core.djangolib.markup import HTML, Text
% endif
</aside>
</section>
% if waffle().is_enabled(ENABLE_IN_CONTEXT_IMAGE_SELECTION):
% if ENABLE_IN_CONTEXT_IMAGE_SELECTION.is_enabled(xblock_locator.course_key):
<div id="edit-image-modal">
<%static:studiofrontend entry="editImageModal">
{

8
package-lock.json generated
View File

@@ -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
},

View File

@@ -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",