diff --git a/cms/static/js/views/metadata.js b/cms/static/js/views/metadata.js index dd28c066a7..20461ef592 100644 --- a/cms/static/js/views/metadata.js +++ b/cms/static/js/views/metadata.js @@ -6,10 +6,11 @@ define( 'js/models/license', 'js/views/license', 'js/views/video/transcripts/utils', 'js/views/video/transcripts/metadata_videolist', - 'js/views/video/translations_editor' + 'js/views/video/translations_editor', + 'edx-ui-toolkit/js/utils/html-utils' ], function(Backbone, BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog, - LicenseModel, LicenseView, TranscriptUtils, VideoList, VideoTranslations) { + LicenseModel, LicenseView, TranscriptUtils, VideoList, VideoTranslations, HtmlUtils) { 'use strict'; var Metadata = {}; @@ -22,10 +23,11 @@ function(Backbone, BaseView, _, MetadataModel, AbstractEditor, FileUpload, Uploa var self = this, counter = 0, locator = self.$el.closest('[data-locator]').data('locator'), - courseKey = self.$el.closest('[data-course-key]').data('course-key'); + courseKey = self.$el.closest('[data-course-key]').data('course-key'), + attributes = {numEntries: this.collection.length, locator: locator}; this.template = this.loadTemplate('metadata-editor'); - this.$el.html(this.template({numEntries: this.collection.length, locator: locator})); + this.$el.html(HtmlUtils.HTML(this.template(attributes)).toString()); this.collection.each( function(model) { @@ -323,12 +325,16 @@ function(Backbone, BaseView, _, MetadataModel, AbstractEditor, FileUpload, Uploa list.empty(); _.each(value, function(ele, index) { var template = _.template( - '
  • ' + - '' + - '' + gettext('Remove') + '' + // eslint-disable-line max-len - '
  • ' + HtmlUtils.joinHtml( + HtmlUtils.HTML('
  • '), + HtmlUtils.HTML(''), + HtmlUtils.HTML(''), // eslint-disable-line max-len + gettext('Remove'), + HtmlUtils.HTML(''), + HtmlUtils.HTML('
  • ') + ).toString() ); - list.append($(template({ele: ele, index: index}))); + list.append(HtmlUtils.HTML($(template({ele: ele, index: index}))).toString()); }); }, @@ -489,17 +495,19 @@ function(Backbone, BaseView, _, MetadataModel, AbstractEditor, FileUpload, Uploa _.each(value, function(value, key) { var template = _.template( - '
  • ' + - '' + - '' + - 'Remove' + // eslint-disable-line max-len - '
  • ' + HtmlUtils.joinHtml( + HtmlUtils.HTML('
  • '), + HtmlUtils.HTML(''), + HtmlUtils.HTML(''), + HtmlUtils.HTML('Remove'), // eslint-disable-line max-len + HtmlUtils.HTML('
  • ') + ).toString() ); frag.appendChild($(template({key: key, value: value}))[0]); }); - list.html([frag]); + list.html(HtmlUtils.HTML([frag]).toString()); }, addEntry: function(event) { @@ -564,7 +572,7 @@ function(Backbone, BaseView, _, MetadataModel, AbstractEditor, FileUpload, Uploa }); this.$('#' + this.uniqueId).val(value); - this.$('.wrapper-uploader-actions').html(html); + this.$('.wrapper-uploader-actions').html(HtmlUtils.HTML((html)).toString()); }, upload: function(event) {