Skip to content

Commit

Permalink
added support for block_html content and annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
gthomas2 committed Feb 22, 2019
1 parent 3dc73c1 commit 155966c
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 1 deletion.
2 changes: 1 addition & 1 deletion amd/build/main.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions amd/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,11 +646,29 @@ function($, Templates, Ally, ImageCover, Util) {
return dfd.promise();
};

/**
* Annotate html block.
* @param mapping
*/
var annotateHtmlBlock = function(mapping) {
var dfd = $.Deferred();

var items = mapping.block_html;
for (var i in items) {
var ident = items[i];
var selector = '#inst' + i + '.block_html > .card-body > .card-text > .no-overflow';
$(selector).attr('data-ally-richcontent', ident);
}
dfd.resolve();
return dfd.promise();
};

/**
* Apply place holders and add annotations to content.
* @return {promise}
*/
var applyPlaceHolders = function() {
M.util.js_pending('filter_ally_applyPlaceHolders');
var dfd = $.Deferred();

if (ally_module_maps === undefined || ally_section_maps === undefined) {
Expand Down Expand Up @@ -694,6 +712,10 @@ function($, Templates, Ally, ImageCover, Util) {
mapVar: {courseId: self.courseId},
method: annotateSnapCourseSummary
},
{
mapVar: ally_annotation_maps,
method: annotateHtmlBlock
}
];

$(document).ready(function() {
Expand All @@ -705,6 +727,7 @@ function($, Templates, Ally, ImageCover, Util) {
completed++;
if (completed === tasks.length) {
// All tasks completed.
M.util.js_complete('filter_ally_applyPlaceHolders');
dfd.resolve();
}
};
Expand Down
Loading

0 comments on commit 155966c

Please sign in to comment.