Commit e59410be by Nimisha Asthagiri

Studio Section Highlights: add doc and preview text to modal

parent d037a19c
...@@ -46,8 +46,10 @@ from contentstore.views.helpers import ( ...@@ -46,8 +46,10 @@ 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.schedules.config import COURSE_UPDATE_WAFFLE_FLAG
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 +82,9 @@ NEVER = lambda x: False ...@@ -80,6 +82,9 @@ NEVER = lambda x: False
ALWAYS = lambda x: True ALWAYS = lambda x: True
highlights_setting = WaffleSwitch(u'dynamic_pacing', u'studio_course_update')
def hash_resource(resource): def hash_resource(resource):
""" """
Hash a :class:`xblock.fragment.FragmentResource`. Hash a :class:`xblock.fragment.FragmentResource`.
...@@ -1185,8 +1190,10 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F ...@@ -1185,8 +1190,10 @@ 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': getattr(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 +1255,6 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F ...@@ -1248,12 +1255,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]
......
...@@ -163,8 +163,10 @@ function(Backbone, _, str, ModuleUtils) { ...@@ -163,8 +163,10 @@ function(Backbone, _, str, ModuleUtils) {
/** /**
* This xBlock's Highlights to message to learners. * This xBlock's Highlights to message to learners.
*/ */
highlights: null, highlights: [],
highlights_enabled: null highlights_enabled: false,
highlights_preview_only: true,
highlights_doc_url: ''
}, },
initialize: function() { initialize: function() {
......
...@@ -236,12 +236,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -236,12 +236,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
}, },
getIntroductionMessage: function() { getIntroductionMessage: function() {
return StringUtils.interpolate( return '';
gettext(
'Enter 3-5 highlights to include in the email message that learners receive for ' +
'this section (250 character limit).'
)
);
}, },
callAnalytics: function(event) { callAnalytics: function(event) {
...@@ -930,7 +925,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -930,7 +925,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
{}, {},
AbstractEditor.prototype.getContext.call(this), AbstractEditor.prototype.getContext.call(this),
{ {
highlights: this.model.get('highlights') || [] highlights: this.model.get('highlights'),
highlights_preview_only: this.model.get('highlights_preview_only'),
highlights_doc_url: this.model.get('highlights_doc_url')
} }
); );
} }
......
...@@ -671,6 +671,10 @@ ...@@ -671,6 +671,10 @@
.highlight-input-label { .highlight-input-label {
font-weight: 600; font-weight: 600;
} }
.highlights-info {
font-size: smaller;
}
} }
// outline: edit item settings // outline: edit item settings
......
<form> <form>
<h3 class="modal-section-title" id="highlights_label"><%- gettext('Section Highlights') %></h3> <h3 class="modal-section-title" id="highlights_label"><%- gettext('Section Highlights') %></h3>
<div class="highlights-info">
<% if (highlights_preview_only) { %>
<p><b>
<%- gettext('This feature is currently in testing. Course teams can enter highlights, but learners will not receive email messages.') %>
</b></p>
<% } %>
<%- gettext('Enter 3-5 highlights to include in the email message that learners receive for this section (250 character limit).') %>
<p>
<br>
<% // xss-lint: disable=underscore-not-escaped %>
<%= edx.HtmlUtils.interpolateHtml(
gettext(
'For more information and an example of the email template, ' +
'read our {linkStart}documentation{linkEnd}.'
),
{
linkStart: edx.HtmlUtils.HTML('<a href="' + highlights_doc_url + '">'),
linkEnd: edx.HtmlUtils.HTML('</a>')
}
) %>
</p>
</div>
<hr>
<div class="modal-section-content block-highlights"> <div class="modal-section-content block-highlights">
<div role="group" class="list-fields" aria-labelledby="highlights_label"> <div role="group" class="list-fields" aria-labelledby="highlights_label">
<% <%
......
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