Files
edx-platform/lms/templates/dashboard/_dashboard_credit_info.html
2019-08-28 16:08:34 +05:00

96 lines
5.6 KiB
HTML

<%page args="credit_status" expression_filter="h"/>
<%!
from django.utils.translation import ugettext as _
from openedx.core.djangolib.markup import HTML, Text
%>
<%namespace name='static' file='../static_content.html'/>
% if credit_status["eligible"]:
<%
provider_link = HTML('<a href="{href}" rel="noopener" target="_blank">{name}</a>').format(
href=credit_status["provider_status_url"],
name=credit_status["provider_name"])
error = credit_status['error']
# Translators: provider_name is the name of a credit provider or university (e.g. State University)
credit_msg = Text(_("You have completed this course and are eligible to purchase course credit. Select {strong_start}Get Credit{strong_end} to get started.")).format(
strong_start=HTML('<strong>'),
strong_end=HTML('</strong>>'))
if credit_status['provider_name']:
credit_msg = _("You are now eligible for credit from {provider}. Congratulations!").format(provider=credit_status['provider_name'])
credit_msg_class = "credit-eligibility-msg"
credit_btn_class = "purchase-credit-btn"
credit_btn_label = _("Get Credit")
ecommerce_url_root = static.get_value('ECOMMERCE_PUBLIC_URL_ROOT', settings.ECOMMERCE_PUBLIC_URL_ROOT)
credit_btn_href = '{root}/credit/checkout/{course_id}/'.format(
root=ecommerce_url_root,
course_id=credit_status['course_key'])
if credit_status["purchased"]:
request_status = credit_status["request_status"]
if request_status is None:
# Learner must initiate the credit request
# Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a credit provider, such as 'State University' or 'Happy Fun Company'.
credit_msg = Text(_("Thank you for your payment. To receive course credit, you must now request credit "
"at the {link_to_provider_site} website. Select {start_bold}Request Credit{end_bold} to get started.")).format(
start_bold=HTML('<b>'),
end_bold=HTML('</b>'),
link_to_provider_site=provider_link,
)
credit_msg_class = "credit-request-not-started-msg"
credit_btn_label = _("Request Credit")
credit_btn_class = 'pending-credit-btn'
elif request_status == 'pending':
# Request received but not reviewed
## Translators: provider_name is the name of a credit provider or university (e.g. State University)
credit_msg = _("{provider_name} has received your course credit request. We will update you when credit processing is complete.").format(provider_name=credit_status["provider_name"])
credit_msg_class = "credit-request-pending-msg"
credit_btn_label = _("View Details")
credit_btn_class = 'pending-credit-btn'
elif request_status == 'approved':
# Credit granted!
# Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a credit provider, such as 'State University' or 'Happy Fun Company'. provider_name is the name of credit provider.
credit_msg = Text(_("{start_bold}Congratulations!{end_bold} {provider_name} has approved your request for course credit. To see your course credit, visit the {link_to_provider_site} website.")).format(
start_bold=HTML('<b>'),
end_bold=HTML('</b>'),
provider_name=credit_status["provider_name"],
link_to_provider_site=provider_link,
)
credit_msg_class = "credit-request-approved-msg"
credit_btn_href = credit_status['provider_status_url']
credit_btn_label = _("View Credit")
elif request_status == 'rejected':
# REJECTED (by the credit provider)!
## Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a credit provider, such as 'State University' or 'Happy Fun Company'. provider_name is the name of credit provider.
credit_msg = Text(_("{provider_name} did not approve your request for course credit. For more information, contact {link_to_provider_site} directly.")).format(
provider_name=credit_status["provider_name"],
link_to_provider_site=provider_link,
)
credit_msg_class = "credit-request-rejected-msg"
credit_btn_label = None
%>
<div class="message message-status is-shown credit-message">
<p class="message-copy is-hidden credit-error-msg" data-credit-error="${credit_status['error']}">
${Text(_("An error occurred with this transaction. For help, contact {support_email}.")).format(
support_email=HTML(u'<a href="mailto:{address}">{address}</a>').format(
address=settings.DEFAULT_FEEDBACK_EMAIL
)
)}
</p>
<div class="credit-action">
% if credit_btn_label:
<a class="btn credit-btn ${credit_btn_class}" href="${credit_btn_href}" rel="noopener" target="_blank" data-course-key="${credit_status['course_key']}" data-user="${user.username}" data-provider="${credit_status['provider_id']}">
${credit_btn_label}
</a>
% endif
<div class="message-copy credit-msg ${credit_msg_class}">${credit_msg}</div>
</div>
</div>
% endif