Skip to content

Commit

Permalink
Merge pull request #196 from edx/sustaining/security-fixes-4
Browse files Browse the repository at this point in the history
Sustaining/security fixes 4
  • Loading branch information
Ali-D-Akbar authored Sep 7, 2020
2 parents 94abf6f + 0631b4b commit e637704
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
16 changes: 12 additions & 4 deletions cms/static/js/views/container.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
define([
'jquery', 'underscore', 'js/views/xblock', 'js/utils/module',
'gettext', 'common/js/components/views/feedback_notification',
'jquery.ui'
'gettext', 'edx-ui-toolkit/js/utils/string-utils',
'common/js/components/views/feedback_notification', 'jquery.ui'
], // The container view uses sortable, which is provided by jquery.ui.
function($, _, XBlockView, ModuleUtils, gettext, NotificationView) {
function($, _, XBlockView, ModuleUtils, gettext, StringUtils, NotificationView) {
'use strict';

var studioXBlockWrapperClass = '.studio-xblock-wrapper';
Expand Down Expand Up @@ -142,7 +142,15 @@ define([
},

makeRequestSpecificSelector: function(selector) {
return 'div.xblock[data-request-token="' + this.requestToken + '"] > ' + selector;
return StringUtils.interpolate(
gettext('{startTag}{requestToken}{endTag}{selector}'),
{
startTag: 'div.xblock[data-request-token="',
requestToken: this.requestToken,
endTag: '"] > ',
selector: selector
}
);
}
});

Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/views/experiment_group_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function(BaseView, _, str, gettext, groupEditTemplate) {
var collection = this.model.collection,
index = collection.indexOf(this.model);

this.$el.html(_.template(groupEditTemplate)({
edx.HtmlUtils.setHtml(this.$el, edx.HtmlUtils.template(groupEditTemplate)({
name: this.model.get('name'),
allocation: this.getAllocation(),
index: index,
Expand Down
12 changes: 9 additions & 3 deletions cms/static/js/views/learning_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ define([
'underscore',
'backbone',
'gettext',
'js/utils/templates'
'js/utils/templates',
'edx-ui-toolkit/js/utils/html-utils'
],
function($, _, Backbone, gettext, TemplateUtils) {
function($, _, Backbone, gettext, TemplateUtils, HtmlUtils) {
'use strict';
var LearningInfoView = Backbone.View.extend({

Expand All @@ -33,7 +34,12 @@ function($, _, Backbone, gettext, TemplateUtils) {
var self = this;
var learning_information = this.model.get('learning_info');
$.each(learning_information, function(index, info) {
$(self.el).append(self.template({index: index, info: info, info_count: learning_information.length}));
var attributes = {
index: index,
info: info,
info_count: learning_information.length
};
$(self.el).append(HtmlUtils.HTML(self.template(attributes)).toString());
});
},

Expand Down
7 changes: 4 additions & 3 deletions cms/static/js/views/list_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
* to the DOM.
*/
define([
'js/views/baseview', 'jquery', 'gettext', 'common/js/components/utils/view_utils'
'js/views/baseview', 'jquery', 'gettext',
'common/js/components/utils/view_utils', 'edx-ui-toolkit/js/utils/html-utils'
], function(
BaseView, $, gettext, ViewUtils
BaseView, $, gettext, ViewUtils, HtmlUtils
) {
'use strict';

Expand Down Expand Up @@ -81,7 +82,7 @@ define([
this.view = this.createDetailsView();
}

this.$el.html(this.view.render().el);
this.$el.html(HtmlUtils.HTML(this.view.render().el).toString());

return this;
}
Expand Down

0 comments on commit e637704

Please sign in to comment.