Merge pull request #12151 from edx/bjacobel/requirejs-errors-in-django-templates
Fix errors in old Django templates / migrate to Mako
This commit is contained in:
@@ -182,7 +182,7 @@ class TestAuthorizationView(TestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# check form is in context and form params are valid
|
||||
context = response.context # pylint: disable=no-member
|
||||
context = response.context_data # pylint: disable=no-member
|
||||
self.assertIn('form', context)
|
||||
self.assertIsNone(context['form']['authorize'].value())
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
@include span-columns(6);
|
||||
@include shift(3);
|
||||
|
||||
float: unset !important; // fixes issues with oauth page and edx-theme footer
|
||||
line-height: 1.5em;
|
||||
padding: 50px 0;
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
{% load sekizai_tags i18n microsite pipeline optional_include %}
|
||||
{% load sekizai_tags i18n microsite pipeline optional_include staticfiles %}
|
||||
{% load url from future %}
|
||||
<html lang="{{LANGUAGE_CODE}}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
{% block title %}<title>{% platform_name %}</title>{% endblock %}
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="{% favicon_path %}" />
|
||||
<link rel="icon" type="image/x-icon" href="{% favicon_path %}" />
|
||||
|
||||
{% with "js/i18n/"|add:LANGUAGE_CODE|add:"/djangojs.js" as i18njs_path %}
|
||||
<script type="text/javascript" src="{% static i18njs_path %}"></script>
|
||||
{% endwith %}
|
||||
|
||||
{% stylesheet 'style-vendor' %}
|
||||
{% stylesheet 'style-main-v1' %}
|
||||
@@ -23,7 +27,7 @@
|
||||
</head>
|
||||
|
||||
<body class="{% block bodyclass %}{% endblock %} lang_{{LANGUAGE_CODE}}">
|
||||
<div class="window-wrap" dir="${static.dir_rtl()}">
|
||||
<div class="window-wrap" dir="{{LANGUAGE_BIDI|yesno:'rtl,ltr'}}">
|
||||
<a class="nav-skip" href="#main">{% trans "Skip to main content" %}</a>
|
||||
{% with course=request.course %}
|
||||
{% include "header.html"|microsite_template_path %}
|
||||
@@ -38,8 +42,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
{% javascript 'application' %}
|
||||
{% javascript 'module-js' %}
|
||||
{% javascript 'base_application' %}
|
||||
|
||||
{% render_block "js" %}
|
||||
</body>
|
||||
|
||||
@@ -1,59 +1,70 @@
|
||||
{% extends "main_django.html" %}
|
||||
## mako
|
||||
|
||||
{% load scope i18n %}
|
||||
<%page expression_filter="h"/>
|
||||
|
||||
{% block bodyclass %}oauth2{% endblock %}
|
||||
<%!
|
||||
from django.utils.translation import ugettext as _
|
||||
from provider.templatetags.scope import scopes
|
||||
from django.core.urlresolvers import reverse
|
||||
from openedx.core.djangolib.markup import Text, HTML
|
||||
%>
|
||||
|
||||
{% block body %}
|
||||
<%inherit file="../main.html"/>
|
||||
|
||||
<%block name="bodyclass">oauth2</%block>
|
||||
|
||||
<%block name="body">
|
||||
<div class="authorization-confirmation">
|
||||
{% if not error %}
|
||||
% if not error:
|
||||
<p>
|
||||
{% blocktrans with application_name=client.name %}
|
||||
<strong>{{ application_name }}</strong> would like to access your data with the following permissions:
|
||||
{% endblocktrans %}
|
||||
${Text(_("{start_strong}{application_name}{end_strong} would like to access your data with the following permissions:")).format(
|
||||
start_strong=HTML("<strong>"),
|
||||
application_name=client.name,
|
||||
end_strong=HTML("</strong>")
|
||||
)}
|
||||
</p>
|
||||
<ul>
|
||||
{% for permission in oauth_data.scope|scopes %}
|
||||
% for permission in scopes(oauth_data['scope']):
|
||||
<li>
|
||||
{% if permission == "openid" %}
|
||||
{% trans "Read your user ID" %}
|
||||
{% elif permission == "profile" %}
|
||||
{% trans "Read your user profile" %}
|
||||
{% elif permission == "email" %}
|
||||
{% trans "Read your email address" %}
|
||||
{% elif permission == "course_staff" %}
|
||||
{% trans "Read the list of courses in which you are a staff member." %}
|
||||
{% elif permission == "course_instructor" %}
|
||||
{% trans "Read the list of courses in which you are an instructor." %}
|
||||
{% elif permission == "permissions" %}
|
||||
{% trans "To see if you are a global staff user" %}
|
||||
{% else %}
|
||||
{% blocktrans %}Manage your data: {{ permission }}{% endblocktrans %}
|
||||
{% endif %}
|
||||
% if permission == "openid":
|
||||
${_("Read your user ID")}
|
||||
% elif permission == "profile":
|
||||
${_("Read your user profile")}
|
||||
% elif permission == "email":
|
||||
${_("Read your email address")}
|
||||
% elif permission == "course_staff":
|
||||
${_("Read the list of courses in which you are a staff member.")}
|
||||
% elif permission == "course_instructor":
|
||||
${_("Read the list of courses in which you are an instructor.")}
|
||||
% elif permission == "permissions":
|
||||
${_("To see if you are a global staff user")}
|
||||
% else:
|
||||
${_("Manage your data: {permission}").format(permission=permission)}
|
||||
% endif
|
||||
</li>
|
||||
{% endfor %}
|
||||
% endfor
|
||||
</ul>
|
||||
<form method="post" action="{% url "oauth2:authorize" %}">
|
||||
{% csrf_token %}
|
||||
{{ form.errors }}
|
||||
{{ form.non_field_errors }}
|
||||
<form method="post" action="${reverse('oauth2:authorize')}">
|
||||
${form.errors}
|
||||
${form.non_field_errors()}
|
||||
<fieldset>
|
||||
<div style="display: none;">
|
||||
<select type="select" name="scope" multiple="multiple">
|
||||
{% for scope in oauth_data.scope|scopes %}
|
||||
<option value="{{ scope }}" selected="selected">{{ scope }}</option>
|
||||
{% endfor %}
|
||||
% for scope in scopes(oauth_data['scope']):
|
||||
<option value="${scope}" selected="selected">${scope}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
<input type="submit" class="btn login large danger" name="cancel" value="Cancel" />
|
||||
<input type="submit" class="btn login large primary" name="authorize" value="Authorize" />
|
||||
</fieldset>
|
||||
<input type="hidden" id="csrf_token" name="csrfmiddlewaretoken" value="${csrf_token}" />
|
||||
</form>
|
||||
{% else %}
|
||||
% else:
|
||||
<p class="error">
|
||||
{{ error }}
|
||||
{{ error_description }}
|
||||
${error}
|
||||
${error_description}
|
||||
</p>
|
||||
{% endif %}
|
||||
% endif
|
||||
</div>
|
||||
{% endblock %}
|
||||
</%block>
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
{% extends "main_django.html" %}
|
||||
{% load i18n %}
|
||||
## mako
|
||||
|
||||
{% block title %}
|
||||
<title>{% trans "Your Password Reset is Complete" %}</title>
|
||||
{% endblock %}
|
||||
<%page expression_filter="h"/>
|
||||
|
||||
{% block bodyextra %}
|
||||
<%!
|
||||
from django.utils.translation import ugettext as _
|
||||
from openedx.core.djangolib.markup import Text, HTML
|
||||
%>
|
||||
|
||||
<%inherit file="../main.html"/>
|
||||
|
||||
<%block name="title">
|
||||
<title>${_("Your Password Reset is Complete")}</title>
|
||||
</%block>
|
||||
|
||||
<%block name="bodyextra">
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
'use strict';
|
||||
@@ -13,23 +21,24 @@
|
||||
$('body').addClass('js');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
</%block>
|
||||
|
||||
{% block bodyclass %}view-passwordreset{% endblock %}
|
||||
<%block name="bodyclass">view-passwordreset</%block>
|
||||
|
||||
{% block body %}
|
||||
<%block name="body">
|
||||
<div id="password-reset-complete-container" class="login-register">
|
||||
<section id="password-reset-complete-anchor" class="form-type">
|
||||
<div id="password-reset-complete" class="form-wrapper">
|
||||
<div class="status submission-success" aria-live="polite">
|
||||
<h4 class="message-title">{% trans "Password Reset Complete" %}</h4>
|
||||
<h4 class="message-title">${_("Password Reset Complete")}</h4>
|
||||
<ul class="message-copy">
|
||||
{% blocktrans with link_start='<a href="/login">' link_end='</a>' %}
|
||||
Your password has been reset. {{ link_start }}Sign in to your account.{{ link_end }}
|
||||
{% endblocktrans %}
|
||||
${Text(_("Your password has been reset. {start_link}Sign-in to your account.{end_link}")).format(
|
||||
start_link=HTML('<a href="/login">'),
|
||||
end_link=HTML('</a>')
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</%block>
|
||||
|
||||
@@ -1,72 +1,85 @@
|
||||
{% extends "main_django.html" %}
|
||||
{% load i18n %}
|
||||
## mako
|
||||
|
||||
{% block title %}
|
||||
<title>
|
||||
{% blocktrans with platform_name=platform_name %}
|
||||
Reset Your {{ platform_name }} Password
|
||||
{% endblocktrans %}
|
||||
</title>
|
||||
{% endblock %}
|
||||
<%page expression_filter="h"/>
|
||||
|
||||
{% block bodyextra %}
|
||||
<script type="text/javascript" src="{{STATIC_URL}}js/student_account/password_reset.js"></script>
|
||||
{% endblock %}
|
||||
<%!
|
||||
from django.utils.translation import ugettext as _
|
||||
from openedx.core.djangolib.markup import Text, HTML
|
||||
%>
|
||||
|
||||
{% block bodyclass %}view-passwordreset{% endblock %}
|
||||
<%inherit file="../main.html"/>
|
||||
|
||||
{% block body %}
|
||||
<%block name="title">
|
||||
<title>${_("Reset Your {platform_name} Password").format(platform_name=platform_name)}</title>
|
||||
</%block>
|
||||
|
||||
<%block name="bodyextra">
|
||||
<script type="text/javascript" src="${STATIC_URL}js/student_account/password_reset.js"></script>
|
||||
</%block>
|
||||
|
||||
<%block name="bodyclass">view-passwordreset</%block>
|
||||
|
||||
<%block name="body">
|
||||
<div id="password-reset-confirm-container" class="login-register">
|
||||
<section id="password-reset-confirm-anchor" class="form-type">
|
||||
<div id="password-reset-confirm-form" class="form-wrapper" aria-live="polite">
|
||||
<div class="status submission-error {% if not err_msg %} hidden {% endif %}">
|
||||
<h4 class="message-title">{% trans "Error Resetting Password" %}</h4>
|
||||
<div class="status submission-error ${'hidden' if not err_msg else ''}">
|
||||
<h4 class="message-title">${_("Error Resetting Password")}</h4>
|
||||
<ul class="message-copy">
|
||||
{% if err_msg %}
|
||||
<li>{{err_msg}}</li>
|
||||
{% else %}
|
||||
<li>{% trans "You must enter and confirm your new password." %}</li>
|
||||
<li>{% trans "The text in both password fields must match." %}</li>
|
||||
{% endif %}
|
||||
% if err_msg:
|
||||
<li>${err_msg}</li>
|
||||
% else:
|
||||
<li>${_("You must enter and confirm your new password.")}</li>
|
||||
<li>${_("The text in both password fields must match.")}</li>
|
||||
% endif
|
||||
</ul>
|
||||
</div>
|
||||
{% if validlink %}
|
||||
|
||||
<form role="form" id="passwordreset-form" method="post" action="">{% csrf_token %}
|
||||
% if validlink:
|
||||
<form role="form" id="passwordreset-form" method="post" action="">
|
||||
<div class="section-title lines">
|
||||
<h2>
|
||||
<span class="text">
|
||||
{% trans "Reset Your Password" %}
|
||||
${_("Reset Your Password")}
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<p class="action-label" id="new_password_help_text">
|
||||
{% trans "Enter and confirm your new password." %}
|
||||
${_("Enter and confirm your new password.")}
|
||||
</p>
|
||||
|
||||
<div class="form-field new_password1-new_password1">
|
||||
<label for="new_password1">{% trans "New Password" %}</label>
|
||||
<label for="new_password1">${_("New Password")}</label>
|
||||
<input id="new_password1" type="password" name="new_password1" aria-describedby="new_password_help_text" />
|
||||
</div>
|
||||
<div class="form-field new_password2-new_password2">
|
||||
<label for="new_password2">{% trans "Confirm Password" %}</label>
|
||||
<label for="new_password2">${_("Confirm Password")}</label>
|
||||
<input id="new_password2" type="password" name="new_password2" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="action action-primary action-update js-reset">{% trans "Reset My Password" %}</button>
|
||||
<input type="hidden" id="csrf_token" name="csrfmiddlewaretoken" value="${csrf_token}">
|
||||
|
||||
<button type="submit" class="action action-primary action-update js-reset">${_("Reset My Password")}</button>
|
||||
</form>
|
||||
{% else %}
|
||||
% else:
|
||||
<div class="status submission-error">
|
||||
<h4 class="message-title">{% trans "Invalid Password Reset Link" %}</h4>
|
||||
<h4 class="message-title">${_("Invalid Password Reset Link")}</h4>
|
||||
<ul class="message-copy">
|
||||
{% blocktrans with start_link='<a href="/login">' end_link='</a>' %}
|
||||
This password reset link is invalid. It may have been used already. To reset your password, go to the {{ start_link }}sign-in{{ end_link }} page and select <strong>Forgot password</strong>.
|
||||
{% endblocktrans %}
|
||||
${Text(_((
|
||||
"This password reset link is invalid. It may have been used already. To reset your password, "
|
||||
"go to the {start_link}sign-in{end_link} page and select {start_strong}Forgot password{end_strong}."
|
||||
))).format(
|
||||
start_link=HTML('<a href="/login">'),
|
||||
end_link=HTML('</a>'),
|
||||
start_strong=HTML('<strong>'),
|
||||
end_strong=HTML('</strong>')
|
||||
)
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
% endif
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</%block>
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
{% extends "main_django.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
## mako
|
||||
|
||||
<%page expression_filter="h"/>
|
||||
|
||||
<%!
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.html import escape
|
||||
%>
|
||||
|
||||
<%inherit file="../main.html"/>
|
||||
|
||||
<%block name="title">
|
||||
<title>
|
||||
Manual Refund
|
||||
</title>
|
||||
{% endblock %}
|
||||
{% block headextra %}
|
||||
</%block>
|
||||
<%block name="headextra">
|
||||
|
||||
<style type="text/css">
|
||||
.errorlist,.messages {
|
||||
@@ -18,56 +27,57 @@ strong {
|
||||
padding-right: 10px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
</%block>
|
||||
|
||||
|
||||
{% block body %}
|
||||
<%block name="body">
|
||||
<div class="content-wrapper" id="content">
|
||||
<div class="container about">
|
||||
<h1>{% trans "Manual Refund" %}</h1>
|
||||
{% if messages %}
|
||||
<h1>${_("Manual Refund")}</h1>
|
||||
% if messages:
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
||||
{% endfor %}
|
||||
% for message in messages:
|
||||
<li class="${message.tags if message.tags else ''}">${message}</li>
|
||||
% endfor
|
||||
</ul>
|
||||
{% endif %}
|
||||
% endif
|
||||
|
||||
<form method="POST" id="refund_form">
|
||||
{% csrf_token %}
|
||||
{{form.as_p}}
|
||||
<input type="hidden" id="csrf_token" name="csrfmiddlewaretoken" value="${csrf_token}" />
|
||||
${form.as_p()}
|
||||
<p>
|
||||
<input type="button" value="Cancel" onclick="javascript:location=location"/> <input type="submit" value="{% if cert %}Refund{% else %}Confirm{% endif %}" />
|
||||
<input type="button" value="Cancel" onclick="javascript:location=location"/> <input type="submit" value="${'Refund' if cert else 'Confirm'}" />
|
||||
</p>
|
||||
</form>
|
||||
{% if cert %}
|
||||
% if cert:
|
||||
<section class="content-wrapper">
|
||||
<h2>
|
||||
{% trans "About to refund this order:" %}
|
||||
${_("About to refund this order:")}
|
||||
</h2>
|
||||
<p>
|
||||
<strong>{% trans "Order Id:" %}</strong> {{cert.order.id}}
|
||||
<strong>${_("Order Id:")}</strong> ${cert.order.id}
|
||||
</p>
|
||||
<p>
|
||||
<strong>{% trans "Enrollment:" %}</strong> {{enrollment.course_id|escape}} {{enrollment.mode}} ({% if enrollment.is_active %}{% trans "enrolled" %}{% else %}{% trans "unenrolled" %}{% endif %})
|
||||
<strong>${_("Enrollment:")}</strong> ${escape(enrollment.course_id)} ${enrollment.mode}
|
||||
(${_("enrolled") if enrollment.is_active else _("unenrolled")})
|
||||
</p>
|
||||
<p>
|
||||
<strong>{% trans "Cost:" %}</strong> {{cert.unit_cost}} {{cert.currency}}
|
||||
<strong>${_("Cost:")}</strong> ${cert.unit_cost} ${cert.currency}
|
||||
</p>
|
||||
<p>
|
||||
<strong>{% trans "CertificateItem Status:" %}</strong> {{cert.status}}
|
||||
<strong>${_("CertificateItem Status:")}</strong> ${cert.status}
|
||||
</p>
|
||||
<p>
|
||||
<strong>{% trans "Order Status:" %}</strong> {{cert.order.status}}
|
||||
<strong>${_("Order Status:")}</strong> ${cert.order.status}
|
||||
</p>
|
||||
<p>
|
||||
<strong>{% trans "Fulfilled Time:" %}</strong> {{cert.fulfilled_time}}
|
||||
<strong>${_("Fulfilled Time:")}</strong> ${cert.fulfilled_time}
|
||||
</p>
|
||||
<p>
|
||||
<strong>{% trans "Refund Request Time:" %}</strong> {{cert.refund_requested_time}}
|
||||
<strong>${_("Refund Request Time:")}</strong> ${cert.refund_requested_time}
|
||||
</p>
|
||||
</section>
|
||||
{% endif %}
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</%block>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
{% block bodyclass %}view-in-course view-wiki{% endblock %}
|
||||
|
||||
{% block headextra %}
|
||||
<script type="text/javascript" src="/i18n.js"></script>
|
||||
{% stylesheet 'course' %}
|
||||
{% stylesheet 'style-course-vendor' %}
|
||||
{% stylesheet 'style-course' %}
|
||||
|
||||
Reference in New Issue
Block a user