Commit dc8b1caf by Nimisha Asthagiri

Studio Section Highlights: add doc and preview text to modal

parent d037a19c
...@@ -46,8 +46,9 @@ from contentstore.views.helpers import ( ...@@ -46,8 +46,9 @@ from contentstore.views.helpers import (
) )
from contentstore.views.preview import get_preview_fragment from contentstore.views.preview import get_preview_fragment
from edxmako.shortcuts import render_to_string from edxmako.shortcuts import render_to_string
from help_tokens.core import HelpUrlExpert
from models.settings.course_grading import CourseGradingModel from models.settings.course_grading import CourseGradingModel
from openedx.core.djangoapps.waffle_utils import WaffleSwitch from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNamespace, WaffleSwitch
from openedx.core.lib.gating import api as gating_api from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.xblock_utils import request_token, wrap_xblock from openedx.core.lib.xblock_utils import request_token, wrap_xblock
from static_replace import replace_static_urls from static_replace import replace_static_urls
...@@ -80,6 +81,14 @@ NEVER = lambda x: False ...@@ -80,6 +81,14 @@ NEVER = lambda x: False
ALWAYS = lambda x: True ALWAYS = lambda x: True
highlights_setting = WaffleSwitch(u'dynamic_pacing', u'studio_course_update')
COURSE_UPDATE_WAFFLE_FLAG = CourseWaffleFlag(
waffle_namespace=WaffleFlagNamespace(name=u'schedules'),
flag_name=u'send_updates_for_course',
flag_undefined_default=False
)
def hash_resource(resource): def hash_resource(resource):
""" """
Hash a :class:`xblock.fragment.FragmentResource`. Hash a :class:`xblock.fragment.FragmentResource`.
...@@ -1186,7 +1195,9 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F ...@@ -1186,7 +1195,9 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
elif xblock.category == 'chapter': elif xblock.category == 'chapter':
xblock_info.update({ xblock_info.update({
'highlights': xblock.highlights, 'highlights': xblock.highlights,
'highlights_enabled': highlights_setting().is_enabled(), 'highlights_enabled': highlights_setting.is_enabled(),
'highlights_preview_only': not COURSE_UPDATE_WAFFLE_FLAG.is_enabled(course.id),
'highlights_doc_url': HelpUrlExpert.the_one().url_for_token('content-highlights'),
}) })
# update xblock_info with special exam information if the feature flag is enabled # update xblock_info with special exam information if the feature flag is enabled
...@@ -1248,12 +1259,6 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F ...@@ -1248,12 +1259,6 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
return xblock_info return xblock_info
def highlights_setting():
namespace = u'dynamic_pacing'
switch = u'studio_course_update'
return WaffleSwitch(namespace, switch)
def add_container_page_publishing_info(xblock, xblock_info): # pylint: disable=invalid-name def add_container_page_publishing_info(xblock, xblock_info): # pylint: disable=invalid-name
""" """
Adds information about the xblock's publish state to the supplied Adds information about the xblock's publish state to the supplied
......
...@@ -2574,7 +2574,7 @@ class TestXBlockInfo(ItemTest): ...@@ -2574,7 +2574,7 @@ class TestXBlockInfo(ItemTest):
def test_highlights_enabled(self): def test_highlights_enabled(self):
chapter = modulestore().get_item(self.chapter.location) chapter = modulestore().get_item(self.chapter.location)
with highlights_setting().override(): with highlights_setting.override():
xblock_info = create_xblock_info(chapter) xblock_info = create_xblock_info(chapter)
self.assertTrue(xblock_info['highlights_enabled']) self.assertTrue(xblock_info['highlights_enabled'])
......
...@@ -32,6 +32,7 @@ group_configurations = course_author:course_features/content_experiments/content ...@@ -32,6 +32,7 @@ group_configurations = course_author:course_features/content_experiments/content
container = course_author:developing_course/course_components.html#components-that-contain-other-components container = course_author:developing_course/course_components.html#components-that-contain-other-components
video = course_author:video/index.html video = course_author:video/index.html
certificates = course_author:set_up_course/studio_add_course_information/studio_creating_certificates.html certificates = course_author:set_up_course/studio_add_course_information/studio_creating_certificates.html
content_highlights = course_author:developing_course/course_sections.html#set-section-highlights-for-weekly-course-highlight-messages
# below are the language directory names for the different locales # below are the language directory names for the different locales
[locales] [locales]
......
...@@ -164,7 +164,9 @@ function(Backbone, _, str, ModuleUtils) { ...@@ -164,7 +164,9 @@ function(Backbone, _, str, ModuleUtils) {
* This xBlock's Highlights to message to learners. * This xBlock's Highlights to message to learners.
*/ */
highlights: null, highlights: null,
highlights_enabled: null highlights_enabled: null,
highlights_preview_only: null,
highlights_doc_url: null
}, },
initialize: function() { initialize: function() {
......
...@@ -236,12 +236,32 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -236,12 +236,32 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
}, },
getIntroductionMessage: function() { getIntroductionMessage: function() {
return StringUtils.interpolate( var preview_text = '';
if (this.model.get('highlights_preview_only')) {
preview_text = StringUtils.interpolate(
gettext(
'We are testing this feature right now. So messages will not actually be sent at this time.'
)
);
preview_text = '<p><b>' + preview_text + '</b></p>';
}
var intro_text = StringUtils.interpolate(
gettext( gettext(
'Enter 3-5 highlights to include in the email message that learners receive for ' + 'Enter 3-5 highlights to include in the email message that learners receive for ' +
'this section (250 character limit).' 'this section (250 character limit).'
) )
); );
var doc_text = StringUtils.interpolate(
gettext(
'For more information and an example of the email template, ' +
'read our {linkStart}documentation{linkEnd}.'
),
{
linkStart: '<a href="{' + this.model.get('highlights_doc_url') + '}">',
linkEnd: '</a>'
}
);
return preview_text + intro_text + '<p>' + doc_text + '</p>';
}, },
callAnalytics: function(event) { callAnalytics: function(event) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment