Change in-context waffle switch to a flag

Also update studio-frontend to version 1.7.1
This commit is contained in:
Tyler Hallada
2018-04-05 16:44:21 -04:00
parent a515277251
commit 71e74949e9
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">
{