From 632bee517799c6deb6e04609d7976905ce54c883 Mon Sep 17 00:00:00 2001 From: Adeel Khan Date: Sat, 13 Jul 2019 04:20:58 +0500 Subject: [PATCH] Fix edx templates. PROD-465 --- .../credit_eligibility_email.html | 5 +++-- lms/templates/forgot_password_modal.html | 12 ++++++++++-- lms/templates/module-error.html | 15 ++++++++------- lms/templates/peer_grading/peer_grading.html | 13 +++++++++---- .../peer_grading/peer_grading_problem.html | 3 ++- lms/templates/secondary_email_change_failed.html | 9 +++++---- .../secondary_email_change_successful.html | 2 +- 7 files changed, 38 insertions(+), 21 deletions(-) diff --git a/lms/templates/credit_notifications/credit_eligibility_email.html b/lms/templates/credit_notifications/credit_eligibility_email.html index be421238b9..9244160284 100644 --- a/lms/templates/credit_notifications/credit_eligibility_email.html +++ b/lms/templates/credit_notifications/credit_eligibility_email.html @@ -1,3 +1,4 @@ +<%page expression_filter="h"/> <%! from django.utils.translation import ugettext as _ from openedx.core.djangolib.markup import HTML, Text @@ -59,11 +60,11 @@

- ${Text(_(u"Course credit can help you get a jump start on your university degree, finish a degree already started, or fulfill requirements at a different academic institution."))} + ${_(u"Course credit can help you get a jump start on your university degree, finish a degree already started, or fulfill requirements at a different academic institution.")}

- ${Text(_(u'There are 2 steps to getting course credit.'))} + ${_(u'There are 2 steps to getting course credit.')}

  1. diff --git a/lms/templates/forgot_password_modal.html b/lms/templates/forgot_password_modal.html index 15e6bd362a..ac35c675d9 100644 --- a/lms/templates/forgot_password_modal.html +++ b/lms/templates/forgot_password_modal.html @@ -1,7 +1,9 @@ +<%page expression_filter="h" /> <%namespace name='static' file='static_content.html'/> <%! from django.utils.translation import ugettext as _ +from openedx.core.djangolib.js_utils import js_escaped_string from django.urls import reverse %> @@ -49,10 +51,16 @@ from django.urls import reverse (function() { $(document).delegate('#pwd_reset_form', 'ajax:success', function(data, json, xhr) { if(json.success) { - $("#password-reset").html(json.value); + $("#password-reset").text(json.value); } else { if($('#pwd_error').length == 0) { - $('#pwd_reset_form').prepend(''); + var msg = "${_("Email is incorrect.") | n, js_escaped_string}"; + var error_msg = HtmlUtils.interpolateHtml( + edx.HtmlUtils.HTML(''), + { + error_msg: msg, + }); + $('#pwd_reset_form').prepend(edx.HtmlUtils.ensureHtml(error_msg).toString()); } $('#pwd_error').stop().css("display", "block"); } diff --git a/lms/templates/module-error.html b/lms/templates/module-error.html index 9fc475603d..e8a251b693 100644 --- a/lms/templates/module-error.html +++ b/lms/templates/module-error.html @@ -1,3 +1,4 @@ +<%page expression_filter="h" /> <%! from django.utils.translation import ugettext as _ from openedx.core.djangolib.markup import HTML, Text @@ -6,15 +7,15 @@ from openedx.core.djangolib.markup import HTML, Text

    - ${_("There has been an error on the {platform_name} servers").format( - platform_name=u"{}".format(static.get_platform_name()) + ${Text(_("There has been an error on the {platform_name} servers")).format( + platform_name=HTML(u"{}").format(static.get_platform_name()) )}

    - ${_("We're sorry, this module is temporarily unavailable. Our staff is working " + ${Text(_("We're sorry, this module is temporarily unavailable. Our staff is working " "to fix it as soon as possible. Please email us at {tech_support_email} to " - "report any problems or downtime.").format( - tech_support_email=u"{0}".format(static.get_tech_support_email_address()) + "report any problems or downtime.")).format( + tech_support_email=HTML(u"{0}").format(static.get_tech_support_email_address()) )}

    @@ -23,13 +24,13 @@ from openedx.core.djangolib.markup import HTML, Text

    ${_("Error:")}

    -${error | h}
    +${error}
     

    ${_("Raw data:")} -

    ${data | h}
    +
    ${data}

    % endif diff --git a/lms/templates/peer_grading/peer_grading.html b/lms/templates/peer_grading/peer_grading.html index c03b61aee9..928d2a6708 100644 --- a/lms/templates/peer_grading/peer_grading.html +++ b/lms/templates/peer_grading/peer_grading.html @@ -1,6 +1,9 @@ -<%! from django.utils.translation import ugettext as _ %> +<%page expression_filter="h"/> +<%! from django.utils.translation import ugettext as _ +from openedx.core.djangolib.markup import HTML, Text +%> <% -nothing_to_grade_message = _( +nothing_to_grade_message = Text(_( """ {p_tag}You currently do not have any peer grading to do. In order to have peer grading to do: {ul_tag} @@ -10,7 +13,9 @@ criteria.{end_li_tag} {li_tag}There must be submissions that are waiting for grading.{end_li_tag} {end_ul_tag} {end_p_tag} -""").format(p_tag="

    ", end_p_tag="

    ", ul_tag="
      ", end_ul_tag="
    ", li_tag="
  2. ", end_li_tag="
  3. ") +""")).format(p_tag=HTML("

    "), end_p_tag=HTML("

    "), + ul_tag=HTML("
      "), end_ul_tag=HTML("
    "), + li_tag=HTML("
  4. "), end_li_tag=HTML("
  5. ")) %>
    @@ -41,7 +46,7 @@ criteria.{end_li_tag} %if problem['closed']: ${problem['problem_name']} %else: - ${problem['problem_name']} + ${problem['problem_name']} %endif diff --git a/lms/templates/peer_grading/peer_grading_problem.html b/lms/templates/peer_grading/peer_grading_problem.html index 67d575dc4f..ec8c87b420 100644 --- a/lms/templates/peer_grading/peer_grading_problem.html +++ b/lms/templates/peer_grading/peer_grading_problem.html @@ -1,6 +1,7 @@ +<%page expression_filter="h"/> <%! from django.utils.translation import ugettext as _ %>
    -
    +
    diff --git a/lms/templates/secondary_email_change_failed.html b/lms/templates/secondary_email_change_failed.html index cff94c9020..42f64f8751 100644 --- a/lms/templates/secondary_email_change_failed.html +++ b/lms/templates/secondary_email_change_failed.html @@ -1,5 +1,7 @@ -## xss-lint: disable=mako-missing-default,python-wrap-html -<%! from django.utils.translation import ugettext as _ %> +<%page expression_filter="h"/> +<%! from django.utils.translation import ugettext as _ +from openedx.core.djangolib.markup import HTML, Text +%> <%inherit file="main.html" /> @@ -14,7 +16,6 @@ % else:

    ${_("We were unable to activate your secondary email {secondary_email}").format(secondary_email=secondary_email)}

    % endif - ## xss-lint: disable=python-wrap-html -

    ${_('Go back to the {link_start}home page{link_end}.').format(link_start='', link_end='')}

    +

    ${Text(_('Go back to the {link_start}home page{link_end}.')).format(link_start=HTML(''), link_end=HTML(''))}

    diff --git a/lms/templates/secondary_email_change_successful.html b/lms/templates/secondary_email_change_successful.html index 0d8d8a0b6e..feeaefaf19 100644 --- a/lms/templates/secondary_email_change_successful.html +++ b/lms/templates/secondary_email_change_successful.html @@ -1,4 +1,4 @@ -## xss-lint: disable=mako-missing-default +<%page expression_filter="h"/> <%inherit file="main.html" /> <%! from django.utils.translation import ugettext as _