diff --git a/lms/templates/course.html b/lms/templates/course.html index 295101da82..884e08b816 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -29,7 +29,7 @@ from six import text_type % if course.advertised_start is not None: % else: - + % endif
@@ -39,7 +39,7 @@ from six import text_type % if course.advertised_start is not None:
  • ${_("Starts")}:
  • % else: -
  • ${_("Starts")}:
  • +
  • ${_("Starts")}:
  • % endif
    diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index e33fd0f034..6104d8fc03 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -1,3 +1,4 @@ +<%page expression_filter="h" /> <%namespace name='static' file='../static_content.html'/> <%! from django.utils.translation import ugettext as _ @@ -7,7 +8,7 @@ from courseware.courses import get_course_about_section from django.conf import settings from six import text_type from edxmako.shortcuts import marketing_link -from openedx.core.djangolib.markup import HTML +from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib.courses import course_image_url from six import string_types %> @@ -16,7 +17,7 @@ from six import string_types <%block name="headextra"> ## OG (Open Graph) title and description added below to give social media info to display ## (https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content#tags) - + @@ -31,21 +32,21 @@ from six import string_types % if can_add_course_to_cart: add_course_complete_handler = function(jqXHR, textStatus) { if (jqXHR.status == 200) { - location.href = "${cart_link}"; + location.href = "${cart_link | n, decode.utf8}"; } if (jqXHR.status == 400) { - $("#register_error") - .html(jqXHR.responseText ? jqXHR.responseText : "${_("An error occurred. Please try again later.")}") + $("#register_error").text( + jqXHR.responseText ? jqXHR.responseText : "${_("An error occurred. Please try again later.") | n, decode.utf8}") .css("display", "block"); } else if (jqXHR.status == 403) { - location.href = "${reg_then_add_to_cart_link}"; + location.href = "${reg_then_add_to_cart_link | n, decode.utf8}"; } }; $("#add_to_cart_post").click(function(event){ $.ajax({ - url: "${reverse('add_course_to_cart', args=[text_type(course.id)])}", + url: "${reverse('add_course_to_cart', args=[text_type(course.id)]) | n, decode.utf8}", type: "POST", /* Rant: HAD TO USE COMPLETE B/C PROMISE.DONE FOR SOME REASON DOES NOT WORK ON THIS PAGE. */ complete: add_course_complete_handler @@ -57,23 +58,23 @@ from six import string_types ## making the conditional around this entire JS block for sanity %if settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: <% - perms_error = _('The currently logged-in user account does not have permission to enroll in this course. ' + perms_error = Text(_('The currently logged-in user account does not have permission to enroll in this course. ' 'You may need to {start_logout_tag}log out{end_tag} then try the enroll button again. ' - 'Please visit the {start_help_tag}help page{end_tag} for a possible solution.').format( - start_help_tag="".format(url=marketing_link('FAQ')), end_tag='', - start_logout_tag="".format(url=reverse('logout')) + 'Please visit the {start_help_tag}help page{end_tag} for a possible solution.')).format( + start_help_tag=HTML("").format(url=marketing_link('FAQ')), end_tag=HTML(''), + start_logout_tag=HTML("").format(url=reverse('logout')) ) %> $('#class_enroll_form').on('ajax:complete', function(event, xhr) { if(xhr.status == 200) { - location.href = "${reverse('dashboard')}"; + location.href = "${reverse('dashboard') | n, decode.utf8}"; } else if (xhr.status == 403) { - location.href = "${reverse('course-specific-register', args=[text_type(course.id)])}?course_id=${course.id | u}&enrollment_action=enroll"; + location.href = "${reverse('course-specific-register', args=[text_type(course.id)]) | n, decode.utf8 }?course_id=${course.id | n, decode.utf8 }&enrollment_action=enroll"; } else if (xhr.status == 400) { //This means the user did not have permission - $('#register_error').html("${perms_error}").css("display", "block"); + $('#register_error').text("${perms_error | n, decode.utf8}").css("display", "block"); } else { - $('#register_error').html( - (xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.")}") + $('#register_error').text( + (xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.") | n, decode.utf8}") ).css("display", "block"); } }); @@ -83,16 +84,16 @@ from six import string_types $('#class_enroll_form').on('ajax:complete', function(event, xhr) { if(xhr.status == 200) { if (xhr.responseText == "") { - location.href = "${reverse('dashboard')}"; + location.href = "${reverse('dashboard') | n, decode.utf8}"; } else { location.href = xhr.responseText; } } else if (xhr.status == 403) { - location.href = "${reverse('register_user')}?course_id=${course.id | u}&enrollment_action=enroll"; + location.href = "${reverse('register_user') | n, decode.utf8 }?course_id=${course.id | n, decode.utf8 }&enrollment_action=enroll"; } else { - $('#register_error').html( - (xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.")}") + $('#register_error').text( + (xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.") | n, decode.utf8}") ).css("display", "block"); } }); @@ -105,7 +106,7 @@ from six import string_types -<%block name="pagetitle">${course.display_name_with_default_escaped} +<%block name="pagetitle">${course.display_name_with_default}
    @@ -116,10 +117,10 @@ from six import string_types

    - ${course.display_name_with_default_escaped} + ${course.display_name_with_default}


    - ${course.display_org_with_default | h} + ${course.display_org_with_default}
    @@ -137,7 +138,7 @@ from six import string_types %elif in_cart: - ${_('This course is in your cart.').format(cart_link=cart_link)} + ${Text(_('This course is in your cart.')).format(cart_link=cart_link)} % elif is_course_full: @@ -164,8 +165,11 @@ from six import string_types reg_element_id = "" %> - ${_("Add {course_name} to Cart ({price} USD)")\ - .format(course_name=course.display_number_with_default, price=course_price)} + ${Text(_("Add {course_name} to Cart {start_span}({price} USD){end_span}")).format( + course_name=course.display_number_with_default, + start_span=HTML(""), + end_span=HTML(""), + price=course_price)}
    %elif allow_anonymous: @@ -186,7 +190,7 @@ from six import string_types href_class = "register" %> - ${_("Enroll in {course_name}").format(course_name=course.display_number_with_default) | h} + ${_("Enroll in {course_name}").format(course_name=course.display_number_with_default)}
    %endif @@ -223,7 +227,7 @@ from six import string_types % endif
    - ${get_course_about_section(request, course, "overview")} + ${HTML(get_course_about_section(request, course, "overview"))}
    @@ -235,7 +239,7 @@ from six import string_types <%block name="course_about_important_dates">
      -
    1. ${_("Course Number")}

      ${course.display_number_with_default | h}
    2. +
    3. ${_("Course Number")}

      ${course.display_number_with_default}
    4. % if not course.start_date_is_still_default: <% course_start_date = course.advertised_start or course.start @@ -249,7 +253,7 @@ from six import string_types <% course_date_string = course_start_date.strftime('%Y-%m-%dT%H:%M:%S%z') %> - + % endif % endif @@ -269,7 +273,7 @@ from six import string_types <% course_date_string = course_end_date.strftime('%Y-%m-%dT%H:%M:%S%z') %> - + % endif % endif @@ -296,9 +300,9 @@ from six import string_types ## Multiple pre-requisite courses are not supported on frontend that's why we are pulling first element ${pre_requisite_courses[0]['display']}

      - ${_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.").format( - link_start=''.format(prc_target), - link_end='', + ${Text(_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.")).format( + link_start=HTML('').format(prc_target), + link_end=HTML(''), prc_display=pre_requisite_courses[0]['display'], )}

      @@ -354,7 +358,7 @@ from six import string_types
      ${pgettext("self","Enroll")} - +