Commit d33c6ecb by Peter Fogg

[safe templates] Commerce templates.

parent 994afbb6
...@@ -39,7 +39,7 @@ var edx = edx || {}; ...@@ -39,7 +39,7 @@ var edx = edx || {};
courseKey: this.courseKey courseKey: this.courseKey
}); });
this.$el.html(_.template(templateHtml)(context)); edx.HtmlUtils.setHtml(this.$el, edx.HtmlUtils.template(templateHtml)(context));
this.trackLinks(); this.trackLinks();
...@@ -67,7 +67,8 @@ var edx = edx || {}; ...@@ -67,7 +67,8 @@ var edx = edx || {};
context.course_key = this.courseKey; context.course_key = this.courseKey;
context.username = this.username; context.username = this.username;
context.platformName = this.$el.data('platform-name'); context.platformName = this.$el.data('platform-name');
providerDiv.html(_.template(templateHtml)(context)).removeClass('hidden'); context.fulfillment_instructions = edx.HtmlUtils.HTML(context.fulfillment_instructions);
edx.HtmlUtils.setHtml(providerDiv, edx.HtmlUtils.template(templateHtml)(context)).removeClass('hidden');
}, },
renderError: function () { renderError: function () {
......
<%! 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" /> <%inherit file="../main.html" />
...@@ -7,6 +12,9 @@ ...@@ -7,6 +12,9 @@
<section class="container"> <section class="container">
<h1>${_("Checkout Cancelled")}</h1> <h1>${_("Checkout Cancelled")}</h1>
${ _(u"Your transaction has been cancelled. If you feel an error has occurred, contact {email}.").format( ${
email="<a href=\"mailto:{email}\">{email}</a>".format(email=payment_support_email)) } Text(_(u"Your transaction has been cancelled. If you feel an error has occurred, contact {email}.")).format(
email=HTML("<a href=\"mailto:{email}\">{email}</a>").format(email=payment_support_email)
)
}
</section> </section>
<%! 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" /> <%inherit file="../main.html" />
...@@ -7,6 +12,12 @@ ...@@ -7,6 +12,12 @@
<section class="container"> <section class="container">
<h1>${_("Checkout Error")}</h1> <h1>${_("Checkout Error")}</h1>
${ _(u"An error has occurred with your payment. <b>You have not been charged.</b> Please try to submit your payment again. If this problem persists, contact {email}.").format( ## Translators: bold_end and bold_start are HTML tags to create bold text.
email="<a href=\"mailto:{email}\">{email}</a>".format(email=payment_support_email)) } ${
Text(_(u"An error has occurred with your payment. {bold_start}You have not been charged.{bold_end} Please try to submit your payment again. If this problem persists, contact {email}.")).format(
email=HTML("<a href=\"mailto:{email}\">{email}</a>").format(email=payment_support_email),
bold_start=HTML('<b>'),
bold_end=HTML('</b>')
)
}
</section> </section>
<%page expression_filter="h"/>
<%! <%!
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
%> %>
......
<div class="provider-wrapper"> <div class="provider-wrapper">
<div class="provider-info"> <div class="provider-info">
<%= interpolate( <%- StringUtils.interpolate(
gettext("You still need to visit the %(display_name)s website to complete the credit process."), gettext("You still need to visit the {display_name} website to complete the credit process."),
{ display_name: display_name }, true { display_name: display_name }
) %> ) %>
</div> </div>
<div class="provider-more-info"> <div class="provider-more-info">
<%= interpolate( <%- StringUtils.interpolate(
gettext("To finalize course credit, %(display_name)s requires %(platform_name)s learners to submit a credit request."), gettext("To finalize course credit, {display_name} requires {platform_name} learners to submit a credit request."),
{ display_name: display_name, platform_name: platformName }, true { display_name: display_name, platform_name: platformName }
) %> ) %>
</div> </div>
<div class="provider-instructions"> <div class="provider-instructions">
<%= fulfillment_instructions %> <%- edx.HtmlUtils.ensureHtml(fulfillment_instructions) %>
</div> </div>
</div> </div>
<div class="provider-buttons-logos"> <div class="provider-buttons-logos">
<div class="provider-logo"> <div class="provider-logo">
<%= interpolate("<img src='%s' alt='%s'></image>", [thumbnail_url, display_name]) %> <img src="<%- thumbnail_url %>" alt="<%- display_name %>" />
</div> </div>
<div class="complete-order"> <div class="complete-order">
<%= interpolate('<button data-provider="%s" data-course-key="%s" data-username="%s" class="complete-course" onClick=completeOrder(this)>%s</button>', [id, course_key, username, <button data-provider="<%- id %>" data-course-key="<%- course_key %>" data-username="<%- username %>" class="complete-course" onClick=completeOrder(this)><%- gettext("Get Credit") %></button>
gettext( "Get Credit")]) %>
</div> </div>
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment