Commit 30dfa98b by Nimisha Asthagiri

Section Highlights Studio UI: Encircle number of highlights

parent dbad9fbc
...@@ -532,7 +532,7 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j ...@@ -532,7 +532,7 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
describe('Section Highlights', function() { describe('Section Highlights', function() {
var createCourse, createCourseWithHighlights, createCourseWithHighlightsDisabled, mockHighlightValues, var createCourse, createCourseWithHighlights, createCourseWithHighlightsDisabled, mockHighlightValues,
highlightsLink, highlightInputs, openHighlights, saveHighlights, setHighlights, highlightsLink, highlightInputs, openHighlights, saveHighlights, setHighlights,
expectHighlightLinkTextToBe, expectHighlightsToBe, expectServerHandshakeWithHighlights, expectHighlightLinkNumberToBe, expectHighlightsToBe, expectServerHandshakeWithHighlights,
expectHighlightsToUpdate, expectHighlightsToUpdate,
maxNumHighlights = 5; maxNumHighlights = 5;
...@@ -591,8 +591,10 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j ...@@ -591,8 +591,10 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
} }
}; };
expectHighlightLinkTextToBe = function(expectedValue) { expectHighlightLinkNumberToBe = function(expectedNumber) {
expect(highlightsLink()).toContainText(expectedValue); var link = highlightsLink();
expect(link).toContainText('Section Highlights');
expect(link.find('.number-highlights')).toHaveHtml(expectedNumber);
}; };
expectHighlightsToBe = function(expectedHighlights) { expectHighlightsToBe = function(expectedHighlights) {
...@@ -645,13 +647,13 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j ...@@ -645,13 +647,13 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
it('displays link when no highlights exist', function() { it('displays link when no highlights exist', function() {
createCourseWithHighlights([]); createCourseWithHighlights([]);
expectHighlightLinkTextToBe('Enter Section Highlights'); expectHighlightLinkNumberToBe(0);
}); });
it('displays link when highlights exist', function() { it('displays link when highlights exist', function() {
var highlights = mockHighlightValues(2); var highlights = mockHighlightValues(2);
createCourseWithHighlights(highlights); createCourseWithHighlights(highlights);
expectHighlightLinkTextToBe('Section Highlights: 2 entered'); expectHighlightLinkNumberToBe(2);
}); });
it('can view when no highlights exist', function() { it('can view when no highlights exist', function() {
......
...@@ -640,10 +640,24 @@ ...@@ -640,10 +640,24 @@
color: theme-color("primary"); color: theme-color("primary");
} }
.number-highlights {
background: theme-color("primary");
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
color: $white;
display: inline-block;
font-weight: bold;
line-height: 18px;
margin-right: 2px;
text-align: center;
width: 18px;
}
.highlight-input-text { .highlight-input-text {
width: 100%; width: 100%;
margin-bottom: 5px; margin-bottom: ($baseline/4);
margin-top: 5px; margin-top: ($baseline/4);
} }
.highlights-description { .highlights-description {
......
...@@ -202,18 +202,11 @@ if (is_proctored_exam) { ...@@ -202,18 +202,11 @@ if (is_proctored_exam) {
<% } %> <% } %>
<% if (xblockInfo.get('highlights_enabled') && course.get('self_paced') && xblockInfo.isChapter()) { %> <% if (xblockInfo.get('highlights_enabled') && course.get('self_paced') && xblockInfo.isChapter()) { %>
<div class="block-highlights"> <div class="block-highlights">
<span class="sr block-highlights-label"><%- gettext('Highlights:') %></span>
<% var number_of_highlights = (xblockInfo.get('highlights') || []).length; %> <% var number_of_highlights = (xblockInfo.get('highlights') || []).length; %>
<% if (number_of_highlights > 0) { %>
<span class="block-highlights-value highlights-button action-button"> <span class="block-highlights-value highlights-button action-button">
<%- edx.StringUtils.interpolate( <span class="number-highlights"><%- number_of_highlights %></span>
gettext('Section Highlights: {number_of_highlights} entered'), <%- gettext('Section Highlights') %>
{number_of_highlights: number_of_highlights}
) %>
</span> </span>
<% } else { %>
<span class="block-highlights-value highlights-button action-button"><%- gettext('Enter Section Highlights') %></span>
<% } %>
</div> </div>
<% } %> <% } %>
<% if (xblockInfo.get('is_time_limited')) { %> <% if (xblockInfo.get('is_time_limited')) { %>
......
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