diff --git a/lms/static/js/discovery/views/refine_sidebar.js b/lms/static/js/discovery/views/refine_sidebar.js index 9004861c5d..c82a9c78f5 100644 --- a/lms/static/js/discovery/views/refine_sidebar.js +++ b/lms/static/js/discovery/views/refine_sidebar.js @@ -4,8 +4,8 @@ define([ 'jquery', 'underscore', 'backbone', - 'gettext' -], function ($, _, Backbone, gettext) { + 'edx-ui-toolkit/js/utils/html-utils' +], function ($, _, Backbone, HtmlUtils) { 'use strict'; return Backbone.View.extend({ @@ -18,10 +18,10 @@ define([ }, initialize: function (options) { - this.meanings = options.meanings || {} + this.meanings = options.meanings || {}; this.$container = this.$el.find('.search-facets-lists'); - this.facetTpl = _.template($('#facet-tpl').html()); - this.facetOptionTpl = _.template($('#facet_option-tpl').html()); + this.facetTpl = HtmlUtils.template($('#facet-tpl').html()); + this.facetOptionTpl = HtmlUtils.template($('#facet_option-tpl').html()); }, facetName: function (key) { @@ -35,31 +35,32 @@ define([ }, renderOptions: function (options) { - var html = _.map(options, function(option) { + return HtmlUtils.joinHtml.apply(this, _.map(options, function(option) { var data = _.clone(option.attributes); data.name = this.termName(data.facet, data.term); return this.facetOptionTpl(data); - }, this).join(''); - return html; + }, this)); }, renderFacet: function (facetKey, options) { return this.facetTpl({ name: facetKey, displayName: this.facetName(facetKey), - options: this.renderOptions(options), + optionsHtml: this.renderOptions(options), listIsHuge: (options.length > 9) }); }, render: function () { var grouped = this.collection.groupBy('facet'); - var html = _.map(grouped, function(options, facetKey) { - if (options.length > 0) { - return this.renderFacet(facetKey, options); - } - }, this).join(''); - this.$container.html(html); + var htmlSnippet = HtmlUtils.joinHtml.apply( + this, _.map(grouped, function(options, facetKey) { + if (options.length > 0) { + return this.renderFacet(facetKey, options); + } + }, this) + ); + HtmlUtils.setHtml(this.$container, htmlSnippet); return this; }, @@ -90,7 +91,7 @@ define([ $target.data('value'), $target.data('text') ); - }, + } }); diff --git a/lms/templates/course.html b/lms/templates/course.html index 324194fe52..a7f31ba4d3 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -3,27 +3,27 @@ from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse %> -<%page args="course" /> -
+<%page args="course" expression_filter="h"/> +
- ${course.display_name_with_default_escaped} ${course.display_number_with_default | h} + ${course.display_name_with_default} ${course.display_number_with_default}
    -
  • ${course.display_org_with_default | h}
  • -
  • ${course.display_number_with_default | h}
  • +
  • ${course.display_org_with_default}
  • +
  • ${course.display_number_with_default}
  • ${_("Starts")}:
diff --git a/lms/templates/courses_list.html b/lms/templates/courses_list.html index 5b90666e9a..e091b4db20 100644 --- a/lms/templates/courses_list.html +++ b/lms/templates/courses_list.html @@ -1,3 +1,4 @@ +<%page expression_filter="h"/> <%namespace name='static' file='static_content.html'/> <%! from django.utils.translation import ugettext as _ %> diff --git a/lms/templates/discovery/course_card.underscore b/lms/templates/discovery/course_card.underscore index 03f6486b36..ffb107f806 100644 --- a/lms/templates/discovery/course_card.underscore +++ b/lms/templates/discovery/course_card.underscore @@ -1,19 +1,19 @@ -
+
- <%= content.display_name %> <%= content.number %> - + <%- content.display_name %> <%- content.number %> +
    -
  • <%= org %>
  • -
  • <%= content.number %>
  • -
  • <%= gettext("Starts") %>
  • +
  • <%- org %>
  • +
  • <%- content.number %>
  • +
  • <%- gettext("Starts") %>
diff --git a/lms/templates/discovery/facet.underscore b/lms/templates/discovery/facet.underscore index 99983ba5d7..fc086821f2 100644 --- a/lms/templates/discovery/facet.underscore +++ b/lms/templates/discovery/facet.underscore @@ -1,16 +1,16 @@

- <%= displayName %> + <%- displayName %>

-
    - <%= options %> +
      + <%= HtmlUtils.ensureHtml(optionsHtml) %>
    <% if (listIsHuge) { %>
    <% } %> diff --git a/lms/templates/discovery/facet_option.underscore b/lms/templates/discovery/facet_option.underscore index 6706dd365a..e6781adc04 100644 --- a/lms/templates/discovery/facet_option.underscore +++ b/lms/templates/discovery/facet_option.underscore @@ -1,8 +1,8 @@
  • -
  • diff --git a/lms/templates/discovery/filter_bar.underscore b/lms/templates/discovery/filter_bar.underscore index 1359fb1201..1410581888 100644 --- a/lms/templates/discovery/filter_bar.underscore +++ b/lms/templates/discovery/filter_bar.underscore @@ -1,4 +1,4 @@
      - +